Preparing search index...

    Class VectorGradient

    An immutable gradient paint — a linear or radial color ramp with a VectorComposite.SpreadMode. Produced by VectorGradientBuilder#build and never mutated after. A gradient carries only paint (geometry + color stops + spread), not path geometry, so it is freely shareable: wrap it in a VectorPaint.gradient and pass that paint to multiple VectorCompositeBuilder#addPath calls to fill several paths with one gradient. Exposes read-only metadata — its VectorGradient#kind, VectorGradient#stopCount, and VectorGradient#spread.

    Lens Scripting Version 370

    var gb = VectorGradientBuilder.linear(new vec2(0, 0), new vec2(512, 0));
    gb.addColorStop(0.0, new vec4(0.92, 0.26, 0.21, 1.0));
    gb.addColorStop(1.0, new vec4(0.13, 0.59, 0.95, 1.0));
    gb.setSpread(VectorComposite.SpreadMode.Reflect);
    var gradient = gb.build();
    print(gradient.kind); // VectorComposite.GradientKind.Linear
    print(gradient.stopCount); // 2

    Hierarchy (View Summary)

    Index

    Properties

    Whether this gradient is linear or radial.

    Lens Scripting Version 370

    spread: SpreadMode

    The VectorComposite.SpreadMode — how the gradient extends beyond its [0, 1] parameter range.

    Lens Scripting Version 370

    stopCount: number

    The number of color stops (between 2 and 16, inclusive).

    Lens Scripting Version 370

    Methods

    • Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

      Returns string

      Lens Scripting Version 370

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean