Adds a color stop at offset (a finite Number, clamped to [0, 1]) with color
(a normalized straight-alpha RGBA vec4; components outside [0, 1] are clamped).
Stops may be added in any order — VectorGradientBuilder#build sorts them
ascending by offset (stably, so equal offsets keep insertion order). Throws if
offset or any color component is not finite.
The stop position (Number, finite, clamped to [0, 1]).
Normalized RGBA color (vec4, each component clamped to [0, 1]).
Validates the accumulated state and returns a new immutable VectorGradient. Throws if the builder does not have between 2 and 16 color stops. The stops are sorted ascending by offset (stably) in the returned gradient. The builder remains usable afterward; the returned gradient is an independent snapshot.
StaticgetReturns the name of this object's type.
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
StaticlinearCreates a builder for a linear gradient whose color ramp runs from start
(parameter 0) to end (parameter 1). Throws if start and end coincide, or
if either coordinate is not finite.
StaticradialCreates a builder for a radial gradient centered at center with outer radius
radius. Without a VectorGradientBuilder#setFocal call the gradient is
concentric (focal point at the center, focal radius 0). Throws if radius is not
greater than 0, or if center or radius is not finite.
The gradient's center (vec2), in composite coordinate space.
The outer radius (Number, must be > 0).
Radial only: sets the focal circle for an off-center highlight. By default (no
call) the gradient is concentric. Throws if called on a linear builder, if
focalRadius is negative, or if focalCenter or focalRadius is not finite.
The focal point (vec2), in composite coordinate space.
The focal radius (Number, must be >= 0).
Sets the VectorComposite.SpreadMode — how the gradient extends beyond its
[0, 1] range. Defaults to VectorComposite.SpreadMode.Pad.
The spread mode.
A mutable builder for an immutable VectorGradient paint. Start one with the VectorGradientBuilder.linear or VectorGradientBuilder.radial factory, add at least two color stops with VectorGradientBuilder#addColorStop, optionally set a focal circle (VectorGradientBuilder#setFocal, radial only) and a spread mode, then call VectorGradientBuilder#build to produce the gradient. Coordinates are native
vec2values in the consuming composite's coordinate space (the same space as path points); colors are normalized straight-alphavec4values. The builder remains usable afterbuild().Since
Lens Scripting Version 370
Snap OS
Example