Api Sandbox Gradient
struct

Gradient

public sealed struct Gradient

Describes a gradient between multiple colors

Constructors

Gradient(ColorFrame[] frames)
Gradient()

Properties

Name Type Description
Blending BlendMode The blend mode
Colors ImmutableList<ColorFrame> A list of color stops, which should be ordered by time
Alphas ImmutableList<AlphaFrame> A list of color stops, which should be ordered by time
Item ColorFrame

Methods

Gradient WithFrames(ImmutableList<ColorFrame> frames)
Int32 AddColor(Single x, Color color)

Add a color position

Int32 AddAlpha(Single x, Single alpha)

Add an alpha position

Void FixOrder()

If the lists aren't in time order for some reason, this will fix them. This should really just be called when serializing, and in every other situation we should assume they're okay.

Int32 AddColor(ColorFrame keyframe)

Add given keyframe to this curve.

keyframe — The keyframe to add.
returns — The position of newly added keyframe in the Colors list.
Int32 AddAlpha(AlphaFrame keyframe)
Color Evaluate(Single time)

Evaluate the blend using the time, which is generally between 0 and 1

static Gradient FromColors(Color[] colors)

Create a gradient from colors spaced out evenly

Assembly: Sandbox.System Namespace: Sandbox Full Name: Sandbox.Gradient