Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Dynamic Token Ring Manager.

    Index

    Constructors

    Properties

    bkgColorLittleEndian: number = 0xFFFFFF
    bkgName: string
    bkgUVs: Float32Array
    colorBand: RingColorBand
    defaultBackgroundColorLittleEndian: number | null = null
    defaultRingColorLittleEndian: number | null = null
    effects: number = 0
    maskName: string
    maskUVs: Float32Array
    ringColorLittleEndian: number = 0xFFFFFF
    ringName: string
    ringUVs: Float32Array
    scaleAdjustmentX: number = 1
    scaleAdjustmentY: number = 1
    scaleCorrection: number = 1
    subjectScaleAdjustment: number = 1
    textureScaleAdjustment: number = 1
    baseTexture: BaseTexture<Resource, IAutoDetectOptions>

    Token Rings sprite sheet base texture.

    effects: Readonly<
        {
            BKG_WAVE: 8;
            COLOR_OVER_SUBJECT: 32;
            DISABLED: 0;
            ENABLED: 1;
            INVISIBILITY: 16;
            RING_GRADIENT: 4;
            RING_PULSE: 2;
        },
    > = ...

    The effects which could be applied to a token ring (using bitwise operations).

    texturesData: Record<
        string,
        { center: { x: number; y: number }; UVs: Float32Array },
    >

    Rings and background textures UVs and center offset.

    tokenRingSamplerShader: any

    The token ring shader class definition.

    Accessors

    • get initialized(): boolean | null

      Is the token rings framework enabled? Will be null if the system hasn't initialized yet.

      Returns boolean | null

    Methods

    • Clear configuration pertaining to token ring from the mesh.

      Returns void

    • Configure the sprite mesh.

      Parameters

      • Optionalmesh: any

        The mesh to which TokenRing functionality is configured (default to token.mesh)

      Returns void

    • Configure token ring size according to mesh texture, token dimensions, fit mode, and dynamic ring fit mode.

      Parameters

      • Optionaloptions: { fit?: string; scaleMultiplier?: number } = {}
        • Optionalfit?: string

          The desired fit mode

        • OptionalscaleMultiplier?: number

          A custom scale multiplier applied on scale correction

      Returns void

    • Configure the token ring visuals properties.

      Returns void

    • Flash the ring briefly with a certain color.

      Parameters

      • color: Color

        Color to flash.

      • animationOptions: CanvasAnimationOptions = {}

        Options to customize the animation.

      Returns Promise<boolean | void>

    • Create texture UVs for each asset into the token rings sprite sheet.

      Returns void

    • Create an easing function that spikes in the center. Ideal duration is around 1600ms.

      Parameters

      • OptionalspikePct: number = 0.5

        Position on [0,1] where the spike occurs.

      Returns Function

    • Soft ping pong curve for photosensitive people.

      Parameters

      • pt: number

        The proportional animation timing on [0,1].

      Returns number

      The eased animation progress on [0,1].

    • Easing function that produces two peaks before returning to the original value. Ideal duration is around 500ms.

      Parameters

      • pt: number

        The proportional animation timing on [0,1].

      Returns number

      The eased animation progress on [0,1].

    • Get ring and background names for a given size.

      Parameters

      • size: number

        The size to match (grid size dimension)

      Returns RingData

    • Get the UVs array for a given texture name and scale correction.

      Parameters

      • name: string

        Name of the texture we want to get UVs.

      • OptionalscaleCorrection: number = 1

        The scale correction applied to UVs.

      Returns void | Float32Array

    • Initialize the Token Rings system, registering the batch plugin and patching PrimaryCanvasGroup#addToken.

      Returns void