VFX-JS
    Preparing search index...

    Electric "Saber" energy around an element's silhouette.

    The silhouette is contour-traced on the CPU, then flooded into a
    distance + arc-length field with the Jump Flooding Algorithm and
    cached. It re-traces when the buffer resizes or edgeThreshold
    changes (every frame in dynamic mode), and re-floods the kept
    contours when progress or pulseMinLength moves. Call
    invalidate to force a rebuild (e.g. after the source content
    changes).

    Mutate params directly or via setParams — the render uniforms
    read live each frame, so a reactive UI can bind straight to params.

    Implements

    Index

    Constructors

    Properties

    params: SaberParams

    Methods

    • Force the distance field to be rebuilt on the next frame.

      Returns void

    • The rect this stage draws into, as [x, y, w, h].

      Coordinates are in physical pixels, relative to the element, with
      the origin at the bottom-left.

      Omit this method (or return undefined) when the effect does not
      change the size of the content, such as a grayscale or invert
      filter. The stage then draws into the same rect as its input.

      Some common rects to return:

      • dims.contentRect — just the element, with no extra space.
      • The element plus px extra pixels on every side, for effects
        like blur, glow, or drop shadow:
        [-px, -px, elementPixel[0] + 2 * px, elementPixel[1] + 2 * px].
      • dims.canvasRect — the whole canvas, including the
        scrollPadding area around the viewport.

      Each stage picks its own rect. If one stage returns 100×100 and
      the next returns 50×50, those are the sizes used; rects do not
      grow as the chain runs.

      Parameters

      Returns readonly [number, number, number, number]