카테고리 없음
actionscript gradient & line 구현
longer
2010. 8. 12. 15:07
The graphics object can also draw strokes and fills with gradients rather than solid colors. A gradient stroke is created with the lineGradientStyle() method and a gradient fill is created with the beginGradientFill() method.
Both methods accept the same parameters. The first four are required: type, colors, alphas, and ratios. The remaining four are optional but are useful for advanced customizing.
-The first parameter specifies the type of gradient you are creating. Acceptable values are GradientType.LINEAR or GradientType.RADIAL.
-The second parameter specifies the array of the color values to use. In a linear gradient, the colors will be arranged from left to right. In a radial gradient, they will be arranged from inside to outside. The order of the colors of the array represents the order that the colors will be drawn in the gradient.
-The third parameter specifies the alpha transparency values of the corresponding colors in the previous parameter.
-The fourth parameter specifies ratios, or the emphasis each color has within the gradient. Acceptable values range from 0-255. These values do not represent any width or height, but rather the position within the gradient; 0 represents the beginning of the gradient, 255 represents the end of the gradient. The array of ratios must increase sequentially and have the same number of entries as both the color and alpha arrays specified in the second and third parameters.
Although the fifth parameter, the transformation matrix, is optional, it is commonly used because it provides an easy and powerful way to control the gradient’s appearance. This parameter accepts a Matrix instance. The easiest way to create a Matrix object for a gradient is to use the Matrix class’s createGradientBox()method.
Defining a Matrix object for use with a gradient
You use the beginGradientFill() and lineGradientStyle() methods of the flash.display.Graphics class to define gradients for use in shapes. When you define a gradient, you supply a matrix as one of the parameters of these methods.
The easiest way to define the matrix is by using the Matrix class’s createGradientBox() method, which creates a matrix that is used to define the gradient. You define the scale, rotation, and position of the gradient using the parameters passed to the createGradientBox() method. The createGradientBox() method accepts the following parameters:
Gradient box width: the width (in pixels) to which the gradient will spread
Gradient box height: the height (in pixels) to which the gradient will spread
Gradient box rotation: the rotation (in radians) that will be applied to the gradient
Horizontal translation: how far (in pixels) the gradient is shifted horizontally
Vertical translation: how far (in pixels) the gradient is shifted vertically
For example, consider a gradient with the following characteristics:
GradientType.LINEAR
Two colors, green and blue, with the ratios array set to [0, 255]
SpreadMethod.PAD
InterpolationMethod.LINEAR_RGB
The following examples show gradients in which the rotation parameter of the createGradientBox() method differs as indicated, but all other settings stay the same:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7dd7.html
추가적인 홈페이지:
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Graphics.html
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Graphics.html#includeExamplesSummary
플래시 소스코드를 볼수 있는 툴
http://www.moock.org/eas3/examples/
구글에 swf decompiler 를 검색하세용