VFX-JS
    Preparing search index...

    Class VFX

    The main interface of VFX-JS.

    Index

    Constructors

    • Creates VFX instance and start playing immediately.

      Parameters

      Returns VFX

      When WebGL is not available in the current environment.

    Accessors

    • get maxTextureSize(): number

      Returns number

    Methods

    • Create a VFX instance if WebGL is available, or return null.

      Parameters

      Returns VFX | null

    • Register an element to track the position and render visual effects in the area.

      Parameters

      • element: HTMLElement
      • opts: VFXProps
      • OptionalinitialCapture: OffscreenCanvas

      Returns Promise<void>

    • Register an element using html-in-canvas API.
      Wraps the element in a <canvas layoutsubtree> and captures via drawElementImage.
      Falls back to add() if html-in-canvas is not supported.

      Parameters

      Returns Promise<void>

    • Remove the element from VFX and stop rendering the shader.

      Parameters

      • element: HTMLElement

      Returns void

    • Update the texture for the given element.

      If the element is an HTMLImageElemnt or HTMLVideoElement, VFX-JS does nothing.
      Otherwise, VFX-JS captures a new snapshot of the DOM tree under the elemnt and udpate the WebGL texture with it.

      This is useful to apply effects to eleents whose contents change dynamically (e.g. input, textare etc).

      Parameters

      • element: HTMLElement

      Returns Promise<void>

    • Start rendering VFX.

      Returns void

    • Stop rendering VFX.
      You can restart rendering by calling VFX.play() later.

      Returns void

    • Render the whole scene once, manually.
      This is useful when you want to control the rendering timings manually by combining with autoplay: false.

      Returns void

    • Destroy VFX and stop rendering.

      Returns void