Skip to content

format

typescript
Gradient.RemoveColorFrame(index)

class: Gradient

description

Remove the color keyframe at the specified index.

parameter

param_nametypedescription
indexnumberThe index of the keyframe.

reture

typedescription
void

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 color keyframes
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)); 
// Remove the color keyframe at the specified index
gradient.RemoveColorFrame(1);