Skip to content

format

typescript
Gradient.GetColorFrame(index)

class: Gradient

description

Get the color keyframe at the specified index.

parameter

param_nametypedescription
indexnumberThe index of the keyframe.

reture

typedescription
KeyFrameColorRGBThe color keyframe.

code example

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 a color keyframe
gradient.AddColorFrame(CreateColorFrame(1,0,0,0)); 
// Set the value of the color keyframe at the specified index
gradient.SetColorFrame(0,CreateColorFrame(1,255,0,0));
// Get the color keyframe at the specified index
gradient.GetColorFrame(0);