The WithFrames
method allows you to create a new Gradient
instance with a specified list of color frames. This method is useful when you want to define a gradient with specific color stops, each represented by a ColorFrame
object.
The WithFrames
method allows you to create a new Gradient
instance with a specified list of color frames. This method is useful when you want to define a gradient with specific color stops, each represented by a ColorFrame
object.
To use the WithFrames
method, you need to provide an immutable list of ColorFrame
objects. Each ColorFrame
should specify a color and a position in the gradient. The method returns a new Gradient
instance configured with the provided frames.
// Example of using the WithFrames method var colorFrames = ImmutableList.Create( new Gradient.ColorFrame(0.0f, Color.Red), new Gradient.ColorFrame(0.5f, Color.Green), new Gradient.ColorFrame(1.0f, Color.Blue) ); Gradient gradient = new Gradient().WithFrames(colorFrames); // Now you can use the gradient object as needed