Preparing search index...

    Class VectorPath

    An immutable 2D path: an ordered list of contours built from straight and curved segments. Produced by VectorPathBuilder#build and never mutated after. Exposes read-only geometry — the number of contours and on-path anchor points, the axis-aligned Rect bounds, and arc lengths. Coordinates are 2-component vectors [x, y].

    Lens Scripting Version 370

    var builder = VectorPathBuilder.create();
    builder.moveTo([0, 0]);
    builder.lineTo([1, 0]);
    builder.lineTo([1, 1]);
    var path = builder.build();
    print(path.subpathCount); // 1
    print(path.pointCount); // 3
    print(path.totalLength); // 2

    Hierarchy (View Summary)

    Index

    Properties

    bounds: Rect

    The axis-aligned bounding box of the path geometry, as a Rect. Curved segments contribute their flattened extent. An empty path reports a zero rectangle.

    Lens Scripting Version 370

    isEmpty: boolean

    True when the path has no drawable geometry (no segments).

    Lens Scripting Version 370

    pointCount: number

    The number of on-path anchor points — the endpoints passed to moveTo/lineTo/cubicTo/quadTo. Control points are not counted. Equals getPoints().length.

    Lens Scripting Version 370

    subpathCount: number

    The number of contours (subpaths) in the path. Each moveTo on the builder begins a new contour.

    Lens Scripting Version 370

    totalLength: number

    The sum of the arc lengths of all contours. Curved segments are measured by flattening.

    Lens Scripting Version 370

    Methods

    • The arc length of contour index (0-based). Throws if index is out of range.

      Parameters

      • index: number

      Returns number

      Lens Scripting Version 370

    • The on-path anchor points (the segment endpoints), in path order across all contours. Control points are not included.

      Returns vec2[]

      Lens Scripting Version 370

    • 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