> ## Documentation Index
> Fetch the complete documentation index at: https://hyperframes.heygen.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SVG Mask Reveal

> A soft token-colored sweep reveals media only through an editable SVG wordmark mask.

export const InstallCommand = ({command}) => {
  const [copied, setCopied] = React.useState(false);
  const copy = async () => {
    try {
      if (navigator.clipboard && window.isSecureContext) {
        await navigator.clipboard.writeText(command);
      } else {
        const previous = document.activeElement;
        const scratch = document.createElement("textarea");
        scratch.value = command;
        scratch.setAttribute("readonly", "");
        scratch.style.position = "fixed";
        scratch.style.opacity = "0";
        document.body.appendChild(scratch);
        scratch.select();
        document.execCommand("copy");
        document.body.removeChild(scratch);
        previous?.focus?.();
      }
      setCopied(true);
      setTimeout(() => setCopied(false), 2000);
    } catch {}
  };
  return <div className="hf-install-command not-prose my-4 flex items-stretch overflow-hidden rounded-xl border border-zinc-200 bg-zinc-50 dark:border-zinc-800 dark:bg-zinc-900">
      <code className="flex-1 overflow-x-auto whitespace-nowrap border-r border-zinc-200 px-4 py-3 font-mono text-sm text-zinc-800 dark:border-zinc-800 dark:text-zinc-100">
        {command}
      </code>
      <button type="button" onClick={copy} data-copied={copied ? "true" : "false"} aria-label={`Copy ${command} to the clipboard`} className="hf-install-copy">
        <svg className="hf-install-copy-clipboard" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 18 18" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" />
          <path d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" />
        </svg>
        <svg className="hf-install-copy-check" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 18 18" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M2.75 9.5L6.5 13.25L15.25 4.5" />
        </svg>
      </button>
      <span className="hf-install-copy-status" role="status" aria-live="polite">
        {copied ? "Copied" : ""}
      </span>
    </div>;
};

<iframe className="w-full aspect-video rounded-xl border-0 bg-zinc-100 dark:bg-zinc-800" title="svg-mask-reveal preview" loading="lazy" srcDoc={`<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;height:100%;overflow:hidden;background:transparent}hyperframes-player{display:block;width:100%;height:100%}</style><script src="https://cdn.jsdelivr.net/npm/@hyperframes/player@0.7/dist/hyperframes-player.global.js"><\/script></head><body><script>fetch("/public/catalog/components/svg-mask-reveal.json").then(function(r){return r.json()}).then(function(d){var p=document.createElement("hyperframes-player");p.setAttribute("srcdoc",d.html);p.setAttribute("controls","");p.setAttribute("autoplay","");p.setAttribute("loop","");p.setAttribute("muted","");p.setAttribute("poster","https://static.heygen.ai/hyperframes-oss/docs/images/catalog/components/svg-mask-reveal.png");document.body.appendChild(p)});<\/script></body></html>`} />

## Install

<InstallCommand command="npx hyperframes add svg-mask-reveal" />

That writes one file: `compositions/components/svg-mask-reveal.html`.

## Paste it into your composition

Open `compositions/components/svg-mask-reveal.html` and copy what is inside into your own composition.

A component has no size or duration of its own. It takes both from the composition
you paste it into.

## Variables

Every one of these has a default, so the piece works untouched. Set the ones you
want to change on the element:

| Variable         | Default  | Accepts                | What it does                           |
| ---------------- | -------- | ---------------------- | -------------------------------------- |
| `text`           | `REVEAL` | string                 | Text used as the SVG mask window.      |
| `revealProgress` | `100`    | 0% to 100%, step 1%    | Final revealed width of the wordmark.  |
| `featherPx`      | `24`     | 0px to 120px, step 1px | Softness of the traveling reveal edge. |

Set them with `data-variable-values` on the element that mounts it. These are the
defaults, so this behaves exactly like the preview above until you change one:

```html wrap theme={null}
<div
  data-composition-id="svg-mask-reveal"
  data-composition-src="compositions/components/svg-mask-reveal.html"
  data-variable-values='{"text":"REVEAL","revealProgress":100,"featherPx":24}'
></div>
```

## Source

<Accordion title={`svg-mask-reveal.html`}>
  ```html theme={null}
  <!doctype html>
  <!--
    svg-mask-reveal -- HyperFrames video primitive (effects / burst / exhibit)

    Concept: token-colored media is visible only through an SVG wordmark mask.
    A soft alpha band crosses the mask from left to right, making the wordmark
    act as a window into the fill beneath it. One mechanic, one job: exhibiting
    a wordmark through a vector mask reveal.

    Compiled-from evidence: hyperframes-research-css-masks.md, SvgMaskReveal and
    "SVG text as mask over image or video". The implementation follows its
    inline SVG, explicit user-space bounds, namespaced fragment IDs, and soft
    reveal geometry guidance.

    Use when: a logo, product name, or short title should reveal a branded fill
    inside its glyphs. Use a path-based sibling when exact brand glyph outlines
    matter more than editable text.

    Variables (declared in data-composition-variables below):
      - text (string, default "REVEAL"): the wordmark used as the SVG mask.
      - revealProgress (number, default 100): final revealed width, 0 to 100%.
      - featherPx (number, default 24): softness of the traveling mask edge.

    Envelope (burst profile, fixed IN/OUT, elastic HOLD):
      IN_BASE  = 0.90s  the soft band sweeps across the wordmark
      HOLD     = max(0, D - (IN_BASE + OUT_BASE)); final state stays readable
      OUT_BASE = 0.45s  the complete wordmark fades cleanly
      If D is shorter than IN_BASE + OUT_BASE, IN and OUT compress together.

    Sync point: SWEEP_LANDS = 0.80s into an uncompressed IN. It scales with IN
    only when the envelope is compressed and never moves into the elastic HOLD.

    Sound: none. The sweep is designed to accept scene-level sound if desired.

    Mount contract: this is a template-wrapped sub-composition. The root has no
    data-width or data-height, fills the host with inset:0, establishes cqw/cqh
    sizing with container-type:size, and registers one paused GSAP timeline under
    the hardcoded composition id "svg-mask-reveal". The demo mounts this file via
    data-composition-src so it exercises the real transport path.
  -->
  <html
    lang="en"
    data-composition-variables='[
      { "id": "text", "type": "string", "role": "content", "label": "Wordmark", "description": "Text used as the SVG mask window.", "default": "REVEAL", "maxLength": 16 },
      { "id": "revealProgress", "type": "number", "role": "content", "label": "Reveal progress", "description": "Final revealed width of the wordmark.", "default": 100, "min": 0, "max": 100, "step": 1, "unit": "%" },
      { "id": "featherPx", "type": "number", "role": "style", "label": "Edge feather", "description": "Softness of the traveling reveal edge.", "default": 24, "min": 0, "max": 120, "step": 1, "unit": "px" }
    ]'
  >
    <head>
      <meta charset="UTF-8" />
      <title>SVG Mask Reveal</title>
    </head>
    <body>
      <template>
        <div
          id="root"
          data-composition-id="svg-mask-reveal"
          data-start="0"
          data-duration="4"
          data-fps="30"
        >
          <style>
            @property --svg-mask-reveal-sweep-x {
              syntax: "<percentage>";
              inherits: false;
              initial-value: -10%;
            }

            *,
            *::before,
            *::after {
              box-sizing: border-box;
            }

            /* INVARIANT: the host owns dimensions. All visible layout derives
               from this size container, and the root is styled only by #root. */
            #root {
              position: absolute;
              inset: 0;
              container-type: size;
              isolation: isolate;
              overflow: hidden;
              background: var(--bg);
              color: var(--fg);
              font-family: var(--font-body);
            }

            .smr-clip,
            .smr-stage {
              position: absolute;
              inset: 0;
              width: 100%;
              height: 100%;
            }

            .smr-stage {
              display: grid;
              place-items: center;
            }

            /* EDIT ZONE: presentation scale. The SVG keeps its 12:5 viewBox
               while these container-relative limits make it fit wide and tall
               hosts without stage-pixel assumptions. */
            .smr-svg {
              display: block;
              width: min(92cqw, 168cqh);
              height: auto;
              overflow: visible;
            }

            .smr-media-start {
              stop-color: var(--brand);
            }

            .smr-media-middle {
              stop-color: var(--accent);
            }

            .smr-media-end {
              stop-color: var(--fg);
            }

            .smr-mask-text {
              fill: var(--fg);
              font-family: var(--font-display);
              font-size: 240px;
              font-weight: 850;
              letter-spacing: 0.02em;
            }

            .smr-media {
              mask-mode: alpha, alpha;
              mask-composite: intersect;
            }

            .smr-outline {
              fill: none;
              stroke: var(--border);
              stroke-width: 2;
              font-family: var(--font-display);
              font-size: 240px;
              font-weight: 850;
              letter-spacing: 0.02em;
            }
          </style>

          <div
            id="svg-mask-reveal-clip"
            class="smr-clip clip"
            data-start="0"
            data-duration="4"
            data-track-index="0"
          >
            <div class="smr-stage">
              <svg
                class="smr-svg"
                viewBox="0 0 1200 500"
                role="img"
                aria-label="REVEAL"
                preserveAspectRatio="xMidYMid meet"
              >
                <defs>
                  <!-- IDs carry the full primitive prefix so fragment URLs do
                       not collide with sibling compositions after assembly. -->
                  <linearGradient
                    id="svg-mask-reveal-media-gradient"
                    gradientUnits="userSpaceOnUse"
                    x1="80"
                    y1="420"
                    x2="1120"
                    y2="80"
                  >
                    <stop class="smr-media-start" offset="0" />
                    <stop class="smr-media-middle" offset="0.52" />
                    <stop class="smr-media-end" offset="1" />
                  </linearGradient>

                  <!-- The word mask owns only the vector silhouette. The media
                       rect independently intersects it with the CSS sweep. -->
                  <mask
                    id="svg-mask-reveal-word-mask"
                    mask-type="alpha"
                    maskUnits="userSpaceOnUse"
                    maskContentUnits="userSpaceOnUse"
                    x="0"
                    y="0"
                    width="1200"
                    height="500"
                  >
                    <text
                      id="svg-mask-reveal-text"
                      class="smr-mask-text"
                      x="600"
                      y="260"
                      text-anchor="middle"
                      dominant-baseline="middle"
                      textLength="1000"
                      lengthAdjust="spacingAndGlyphs"
                    >
                      REVEAL
                    </text>
                  </mask>
                </defs>

                <!-- The outline stays quiet and complete while the token-colored
                     media itself remains visible only through the word mask. -->
                <text
                  id="svg-mask-reveal-outline"
                  class="smr-outline"
                  x="600"
                  y="260"
                  text-anchor="middle"
                  dominant-baseline="middle"
                  textLength="1000"
                  lengthAdjust="spacingAndGlyphs"
                >
                  REVEAL
                </text>
                <rect
                  class="smr-media"
                  x="0"
                  y="0"
                  width="1200"
                  height="500"
                  fill="url(#svg-mask-reveal-media-gradient)"
                />
              </svg>
            </div>
          </div>

          <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
          <script>
            (function () {
              "use strict";

              var root = document.getElementById("root");
              var compositionId = "svg-mask-reveal";
              var stage = root.querySelector(".smr-stage");
              var svg = root.querySelector(".smr-svg");
              var maskText = root.querySelector("#svg-mask-reveal-text");
              var outlineText = root.querySelector("#svg-mask-reveal-outline");
              var mediaRect = root.querySelector(".smr-media");

              // EDIT ZONE: declared defaults are merged with per-instance host
              // overrides by the runtime. Missing and zero are distinct here.
              var vars =
                window.__hyperframes && window.__hyperframes.getVariables
                  ? window.__hyperframes.getVariables()
                  : {};
              var textValue = vars.text == null ? "REVEAL" : String(vars.text);
              var progressValue = vars.revealProgress == null ? NaN : Number(vars.revealProgress);
              var revealProgress = Number.isFinite(progressValue)
                ? Math.max(0, Math.min(100, progressValue))
                : 100;
              var featherValue = vars.featherPx == null ? NaN : Number(vars.featherPx);
              var featherPx = Number.isFinite(featherValue)
                ? Math.max(0, Math.min(120, featherValue))
                : 24;

              maskText.textContent = textValue;
              outlineText.textContent = textValue;
              svg.setAttribute("aria-label", textValue);

              // INVARIANT: the word and sweep masks are independent layers on
              // the media rect. This initialization owns their feather geometry.
              var VIEW_WIDTH = 1200;
              var featherPercent = (featherPx / VIEW_WIDTH) * 100;
              var hiddenSweepPercent = -featherPercent;
              mediaRect.style.maskImage =
                "url(#svg-mask-reveal-word-mask), linear-gradient(to right, black var(--svg-mask-reveal-sweep-x, -10%), transparent calc(var(--svg-mask-reveal-sweep-x, -10%) + " +
                featherPercent +
                "%))";

              // RETIME RANGE: IN_BASE and OUT_BASE define the burst envelope.
              // The sweep uses --ease-standard's GSAP owner, power2.out.
              var IN_BASE = 0.9;
              var OUT_BASE = 0.45;
              var SWEEP_START_BASE = 0.08;
              var SWEEP_LANDS_BASE = 0.8;
              var duration = Math.max(0.001, parseFloat(root.dataset.duration || "4"));
              var envelopeBase = IN_BASE + OUT_BASE;
              var scale = duration < envelopeBase ? duration / envelopeBase : 1;
              var IN = IN_BASE * scale;
              var OUT = OUT_BASE * scale;
              var HOLD = Math.max(0, duration - IN - OUT);
              var OUT_START = IN + HOLD;
              var SWEEP_START = SWEEP_START_BASE * scale;
              var SWEEP_DURATION = (SWEEP_LANDS_BASE - SWEEP_START_BASE) * scale;
              var targetSweepPercent = revealProgress === 0 ? hiddenSweepPercent : revealProgress;

              gsap.set(stage, { opacity: 1 });
              gsap.set(mediaRect, {
                "--svg-mask-reveal-sweep-x": hiddenSweepPercent + "%",
              });

              var tl = gsap.timeline({ paused: true });
              tl.to(
                mediaRect,
                {
                  "--svg-mask-reveal-sweep-x": targetSweepPercent + "%",
                  duration: SWEEP_DURATION,
                  ease: "power2.out",
                },
                SWEEP_START,
              );
              tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
              tl.seek(0);

              window.__timelines = window.__timelines || {};
              window.__timelines[compositionId] = tl;
            })();
          </script>
        </div>
      </template>
    </body>
  </html>
  ```
</Accordion>

Tagged `effect` `svg` `mask` `wordmark` `reveal` `exhibit`.

## Related topics

* [Browse the complete Catalog](/catalog)
* [Add assets and Catalog items in Studio](/studio/assets-and-blocks)
* [Build a richer composition](/go-further)


## Related topics

- [Lower Third — Mask Reveal](/catalog/blocks/lt-mask-reveal.md)
- [Verified example prompts](/prompting/examples.md)
- [3D UI Reveal](/catalog/blocks/ui-3d-reveal.md)
