VegaRise.NET
Back to DOM

GradientStopClass

Definition

Namespace
DOM.Elements.Graphics.Colors
Assembly
DOM.dll

Represents a single color stop within a . Gradient

Remarks

A defines a color and a position along the gradient axis. The gradient interpolates between adjacent stops to produce a smooth transition. GradientStop Both the stop color and the stop position are required for the stop to be meaningful; a default is initialized in the constructor so callers only need to assign and . Color StopColor StopPosition

Examples

csharp
1// 1. Simple red stop at the start of the gradient
2var stop = new GradientStop { StopColor = Color.Red, StopPosition = 0 };
3
csharp
1// 2. Half-way yellow stop
2var stop = new GradientStop { StopColor = Color.Yellow, StopPosition = 50 };
3
csharp
1// 3. End green stop
2var stop = new GradientStop { StopColor = Color.Green, StopPosition = 100 };
3
csharp
1// 4. Build a three-stop gradient
2var gradient = new Gradient
3{
4 GradientStops = new List<IGradientStop>
5 {
6 new GradientStop { StopColor = Color.Red, StopPosition = 0 },
7 new GradientStop { StopColor = Color.Yellow, StopPosition = 50 },
8 new GradientStop { StopColor = Color.Green, StopPosition = 100 }
9 }
10};
11

Properties

StopColorColor

Gets or sets the color of the gradient stop.

StopPositionPercentage

Gets or sets the position of the stop along the gradient axis.

VegaRiseVDocs.NET

Create Account

Create your VDocs account.

or

Already have an account? Sign in