Gradient
The Gradient class represents a gradient color, which is used to describe the process of color changing over time or space.
typescript
function CreateColorFrame(time:number,r:number,g:number,b:number):KeyFrameColorRGB
{
let colorFrame=new KeyFrameColorRGB();
colorFrame.time=time;
colorFrame.r=r;
colorFrame.g=g;
colorFrame.b=b;
return colorFrame;
}
// Create a new gradient object
let gradient = new Gradient();
// Add color keyframes
gradient.AddColorFrame(CreateColorFrame(1,0,0,0));成员变量
Gradient.colorFrameCount : number |
| Color keyframe count. |
Gradient.alphaFrameCount : number |
| Number of opacity keyframes in a color gradient. |
Gradient.mode : GradientBlendMode |
| Blend mode for color gradient blending. |
成员方法
Gradient.RemoveColorFrame ( index : number ) : void |
| Remove the color keyframe at the specified index. |
Gradient.AddColorFrame ( frame : KeyFrameColorRGB ) : void |
| Add a color keyframe. |
Gradient.RemoveAlphaFrame ( index : number ) : void |
| Remove the opacity keyframe at the specified index. |
Gradient.EnsureOrder ( ) : void |
| Sorts all color and alpha nodes in a gradient. |
Gradient.AddAlphaFrame ( frame : KeyFrame ) : void |
| Add an alpha keyframe. |
Gradient.GetColorFrame ( index : number ) : KeyFrameColorRGB |
| Get the color keyframe at the specified index. |
Gradient.Evaluate ( time : number ) : Color |
| Calculates the color value of a gradient at a specified time point. |
Gradient.SetColorFrame ( index : number , val : KeyFrameColorRGB ) : void |
| Set the value of the color keyframe at the specified index. |
Gradient.GetAlphaFrame ( index : number ) : KeyFrame |
| Get the opacity keyframe at the specified index. |
Gradient.SetAlphaFrame ( index : number , val : KeyFrame ) : void |
| Set the value of the transparency keyframe at the specified index. |
Gradient.Clear ( ) : void |
| Clears all color keyframes and opacity keyframes from a color gradient. |
Gradient.toString ( ) : string |
| Get the alias of the Gradient type. |
