Lens Scripting API

    Class Provider

    Base class for all resource providers. Providers are the implementation for Asset.

    For example: VideoTextureProvider is the implementation for a Texture backed by a video file.

    In most cases, providers can be accessed via the control property of an asset.

    For example, we can jump to the last frame of an animated texture:

    // @input Asset.Texture myAnimatedTexture
    const myAnimatedTextureProvider = script.myAnimatedTexture.control;
    const frameCountOfTexture = myAnimatedTextureProvider.getFramesCount();
    myAnimatedTextureProvider.pauseAtFrame(frameCountOfTexture - 1);

    Or do it in TypeScript:

    @component
    export class ProviderExample extends BaseScriptComponent {
    @input()
    myAnimatedTexture: Texture;

    onAwake() {
    const myAnimatedTextureProvider = this.myAnimatedTexture.control as AnimatedTextureFileProvider;
    const frameCountOfTexture = myAnimatedTextureProvider.getFramesCount();
    myAnimatedTextureProvider.pauseAtFrame(frameCountOfTexture - 1);
    }
    }

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Methods

    • 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

    MMNEPVFCICPMFPCPTTAAATR