Update with current status
[gnash.git] / librender / linear.as
blob721e66494345039ad0ce73d396b467929a14acf8
1 // "linear" or "radial"
2 fillType = "linear";
3 // The maximum possible number of colors you can use is 15.
4 colors = [0xFF0000, 0x0000FF];
5 // the transparency of colors you defined in the previous
6 // parameter. The possible values range from 0 (completely
7 // transparent) to 100 (completely opaque). If you specify a value
8 // less then 0, Flash will use 0. If you enter a value greater than
9 // 100, Flash will use 100. It makes sense, because you can’t have
10 // something more transparent than alpha put at 0, beacuse a color or
11 // a drawing with alpha 0 is invisible.
12 alphas = [100, 100];
13 // The ratio defines where in your gradient the color it is associated
14 // with is at its 100% value. Or, the place where that color is pure
15 // and hasn’t started mixing with the other color(s) yet.
16 ratios = [0, 255];
18 // matrixType This value should always be "box".
19 // x,y: are the left-upper corner of the square.
20 // w,h are width and height that the square are going to be stretched to.
21 // r is the rotation of the gradient field.
23 // For box type, the x should be the left margin, the y can be
24 // anything. The w is calculated by right margin-left margin,
25 // the h can be anything except 0.
26 matrix = {matrixType:"box", x:300, y:200, w:200, h:50, r:0/180*Math.PI};
27 _root.lineStyle(1, 0x000000, 100);
29 _root.beginGradientFill(fillType, colors, alphas, ratios, matrix);
31 // X (200) W (150)
32 // | |
33 // (x0, y0) 200,200------------------500,200 (x1, y0)
34 // | |
35 // | |---- Y (300)
36 // | |
37 // (x0, y1) 200,400------------------500,400 (x1, y1)_
40 // This is the dimensions of the big black box that is supposed to have
41 // a linear gradient in it.
42 x0 = 0; // 200 pixels = 4000 twips
43 y0 = 0; // 200 pixels = 4000 twips
44 x1 = 500; // 500 pixels = 10000 twips
45 y1 = 400; // 400 pixels = 8000 twips
46 _root.moveTo(x0, y0);
47 _root.lineTo(x1, y0);
48 _root.lineTo(x1, y1);
49 _root.lineTo(x0, y1);
50 _root.lineTo(x0, y0);
52 _root.endFill();