Preparing search index...

    Class VectorComposite

    A retained, tessellated vector-image asset (built from an SVG document). The asset itself produces no image; a VectorRenderer draws it into a caller-owned render-target Texture. Wait for VectorComposite#ready (or poll VectorComposite#isReady) before drawing.

    Lens Scripting Version 368

    //@input Asset.VectorComposite vectorAsset
    //@input Component.Image image
    var renderer = new VectorRenderer();
    var target = null;
    script.vectorAsset.ready().then(function () {
    // Size the target to the source so the composite fills it.
    var size = script.vectorAsset.intrinsicSize;
    target = scene.createRenderTargetTexture();
    target.control.outputResolution = RenderTargetProvider.OutputResolution.Custom;
    target.control.resolution = new vec2(size.x, size.y);
    script.image.mainMaterial.mainPass.baseTex = target;
    });
    // render() is cheap (replays the retained geometry), so draw every frame.
    script.createEvent("UpdateEvent").bind(function () {
    if (target) { renderer.render(target, script.vectorAsset, null); }
    });

    Hierarchy (View Summary)

    Index

    Properties

    The font source used to resolve text in the vector content — a Font, FontFamily, or FontCollection asset, exactly like Text#fontSource. Text is resolved per run: each <text> (or positioned <tspan>) element in the SVG is one run of text. A Font is used for every run. For a FontFamily or FontCollection, each run's font-family attribute selects a face within the source; a run whose font-family does not match still uses the source's default style. The system font is used only when no source is assigned, or for a run whose font-family is "System". Assignable at runtime; a Font referenced only through this property is still shipped with the Lens.

    Lens Scripting Version 374

    null
    
    //@input Asset.VectorComposite vectorAsset
    //@input Asset.Font customFont
    script.vectorAsset.fontSource = script.customFont;
    intrinsicSize: vec2

    The natural size of the source content — the SVG viewBox for a loaded SVG, or the canvas size passed to VectorCompositeBuilder.create for a builder-constructed composite. Reported as (0, 0) until the asset is ready.

    Lens Scripting Version 368

    isReady: boolean

    True once the retained scene is built (i.e. once VectorComposite#ready has resolved). Not ready means the SVG has not been parsed and tessellated yet: before ready is first called, while that one-time build is in flight, or after a parse failure (where ready rejects and the asset stays not ready). While not ready, VectorComposite#intrinsicSize reads (0, 0) and drawing the asset with a VectorRenderer throws. A cheap synchronous guard to check before drawing.

    Lens Scripting Version 368

    name: string

    The name of the Asset in Lens Studio.

    ""
    
    uniqueIdentifier: string

    Lens Scripting Version 176

    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 368

    • Returns the name of this object's type.

      Returns string

    • 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

    • Returns a Promise that resolves once the source has been parsed and tessellated into the retained scene and the asset is ready to draw; rejects with a parse / unsupported-feature error on failure. The first call kicks off the one-time asynchronous build (parse + tessellate); the same Promise is returned on subsequent calls.

      Returns Promise<void>

      Lens Scripting Version 368