The AddAlpha
method is used to add an alpha keyframe to the gradient at a specified position. This method allows you to define the transparency level of the gradient at a particular point in time.
The AddAlpha
method is used to add an alpha keyframe to the gradient at a specified position. This method allows you to define the transparency level of the gradient at a particular point in time.
To use the AddAlpha
method, you need to provide two parameters:
x
: A float
representing the position in the gradient where the alpha value should be added. This value is typically between 0.0 and 1.0, where 0.0 represents the start of the gradient and 1.0 represents the end.alpha
: A float
representing the alpha value to be added at the specified position. This value should be between 0.0 (completely transparent) and 1.0 (completely opaque).The method returns an int
which is the index of the newly added alpha keyframe in the gradient's alpha list.
// Create a new Gradient instance Gradient gradient = new Gradient(); // Add an alpha keyframe at position 0.5 with an alpha value of 0.75 int index = gradient.AddAlpha(0.5f, 0.75f); // The index variable now holds the position of the added alpha keyframe in the gradient's alpha list.