Color Evaluate( float time )

book_4_sparkGenerated
code_blocksInput

Description

The Evaluate method of the Gradient struct is used to determine the color at a specific point in time along the gradient. This method interpolates between the defined color stops to return a color that corresponds to the given time value.

Usage

To use the Evaluate method, you need to have a Gradient object with defined color stops. You can then call Evaluate with a time parameter, which is a float value representing the position along the gradient (typically between 0.0 and 1.0).

The method will return a Color object that represents the interpolated color at the specified time.

Example

// Create a gradient with color stops
var gradient = new Gradient();
gradient.AddColor(0.0f, Color.Red);
gradient.AddColor(0.5f, Color.Green);
gradient.AddColor(1.0f, Color.Blue);

// Evaluate the color at 25% of the gradient
Color colorAt25Percent = gradient.Evaluate(0.25f);

// The colorAt25Percent will be a blend between Red and Green