public sealed class GradientColour and opacity along a line, as two independent lists of stops.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
⚠ Colour and alpha are separate lists, and that is the whole design. A particle that fades out at the end has one alpha stop; sharing one list would mean duplicating every colour stop to carry the alpha, and then editing a colour in the middle would mean remembering to keep two things in step. Every tool that has tried the single list has ended up here.
Empty means transparent black, one stop means that stop everywhere, and outside the first and last the ends hold — the same clamp AnimationCurve makes and for the same reason.
Fields and properties (4)
public IReadOnlyList<GradientColorStop> ColorStopsThe colour stops, in order.
public IReadOnlyList<GradientAlphaStop> AlphaStopsThe alpha stops, in order.
public GradientInterpolation InterpolationWhich space the colours are mixed in.
public const int MaximumStopsHow many stops of either kind a gradient may have.
Events (1)
public Action<Gradient>? ChangedRaised after anything changes.
Methods (10)
public Gradient()Creates an empty gradient.
public Gradient(Color4 from, Color4 to)Creates a gradient between two colours.
public GradientColorStop? AddColorStop(float position, Color4 color)Adds a colour stop.
public GradientAlphaStop? AddAlphaStop(float position, float alpha)Adds an alpha stop.
public bool Remove(GradientColorStop stop)Removes a colour stop, unless it is the last one.
public bool Remove(GradientAlphaStop stop)Removes an alpha stop, unless it is the last one.
public void Move(GradientColorStop stop, float position)Moves a stop and puts the list back in order.
public void Move(GradientAlphaStop stop, float position)Ditto.
public void Touch()Tells subscribers something changed, for an edit made through a stop directly.
public Color4 Evaluate(float position)The colour at a place, with its alpha.
Used by (5)
- GradientBarVixen.Ui.Controls.Advanced
- GradientEditorVixen.Ui.Controls.Advanced
- GradientEditorTestsVixen.Ui.Controls.Advanced.Tests
- GradientRailVixen.Ui.Controls.Advanced
- GradientTestsVixen.Ui.Controls.Advanced.Tests