> ## 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.

# Drift Hold

> A centered content card stays subtly alive through loop-exact rotation, scale breathing, and a slow light sweep.

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="drift-hold 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/drift-hold.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/drift-hold.png");document.body.appendChild(p)});<\/script></body></html>`} />

## Install

<InstallCommand command="npx hyperframes add drift-hold" />

That writes one file: `compositions/components/drift-hold.html`.

## Paste it into your composition

Open `compositions/components/drift-hold.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`      | `Always alive` | string                | Text displayed in the default centered card.                   |
| `intensity` | `standard`     | `whisper`, `standard` | Amplitude of the ambient rotation, breathing, and light sweep. |

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="drift-hold"
  data-composition-src="compositions/components/drift-hold.html"
  data-variable-values='{"text":"Always alive","intensity":"standard"}'
></div>
```

## Source

<Accordion title={`drift-hold.html`}>
  ```html theme={null}
  <!doctype html>
  <!--
    drift-hold: HyperFrames video primitive (camera / ambient / hold)

    Concept: a centered content card never becomes fully static. Sub-degree
    rotation, restrained scale breathing, and a soft light sweep each follow
    one complete sine cycle across the mounted duration.

    Variables:
      - text (string, default "Always alive"): the card label.
      - intensity (whisper | standard, default "standard"): selects the
        amplitudes for rotation, breathing, and the light sweep.

    Envelope:
      IN = 0s
      HOLD = elastic = the complete mounted duration
      OUT = 0s
      HOLD owns exactly one whole cycle at every duration. The endpoint phase
      is explicitly wrapped to zero so the pose at t=0 exactly equals the pose
      at t=duration.

    Mount contract: the runtime clones only this template. #root fills the
    host box, establishes the container query basis, has no data-width or
    data-height, and registers one paused timeline under the hardcoded
    drift-hold id.
  -->
  <html
    lang="en"
    data-composition-id="drift-hold"
    data-composition-duration="4"
    data-composition-variables='[
      { "id": "text", "type": "string", "role": "content", "label": "Text", "description": "Text displayed in the default centered card.", "default": "Always alive" },
      { "id": "intensity", "type": "enum", "role": "motion", "label": "Intensity", "description": "Amplitude of the ambient rotation, breathing, and light sweep.", "default": "standard", "options": [{ "value": "whisper", "label": "Whisper" }, { "value": "standard", "label": "Standard" }] }
    ]'
  >
    <head>
      <meta charset="UTF-8" />
      <title>Drift Hold</title>
    </head>
    <body>
      <template>
        <div id="root" data-composition-id="drift-hold" data-duration="4" data-fps="30">
          <style>
            *,
            *::before,
            *::after {
              box-sizing: border-box;
            }

            #root {
              position: absolute;
              inset: 0;
              overflow: hidden;
              container-type: size;
              isolation: isolate;
              color: var(--fg, #f8fafc);
              font-family: var(--font-body, Inter, system-ui, sans-serif);
              pointer-events: none;
            }

            .dh-clip {
              position: absolute;
              inset: 0;
              display: grid;
              place-items: center;
              overflow: hidden;
            }

            .dh-card {
              position: relative;
              display: grid;
              width: 68cqw;
              min-height: 44cqh;
              place-items: center;
              overflow: hidden;
              padding: var(--space-3, 5cqh) var(--space-3, 6cqw);
              border: 0.16cqmin solid color-mix(in srgb, var(--border, #475569) 82%, transparent);
              border-radius: var(--radius, 3.2cqmin);
              background: color-mix(in srgb, var(--surface, #172033) 94%, var(--accent, #38bdf8));
              box-shadow: 0 3.5cqh 10cqh color-mix(in srgb, var(--bg, #05070d) 58%, transparent);
              transform-origin: 50% 50%;
              will-change: transform;
            }

            .dh-sweep {
              position: absolute;
              top: -45%;
              left: 42%;
              width: 20cqw;
              height: 190%;
              background: linear-gradient(
                90deg,
                transparent 0%,
                color-mix(in srgb, var(--accent, #38bdf8) 10%, transparent) 25%,
                color-mix(in srgb, var(--fg, #f8fafc) 28%, transparent) 50%,
                color-mix(in srgb, var(--accent, #38bdf8) 10%, transparent) 75%,
                transparent 100%
              );
              filter: blur(1.8cqmin);
              will-change: transform, opacity;
            }

            .dh-label {
              position: relative;
              z-index: 1;
              max-width: 56cqw;
              overflow: hidden;
              color: var(--fg, #f8fafc);
              font-family: var(--font-display, Inter, system-ui, sans-serif);
              font-size: clamp(20px, 9cqmin, 76px);
              font-weight: 720;
              line-height: 1.05;
              letter-spacing: -0.035em;
              text-align: center;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
          </style>

          <div
            id="drift-hold-clip"
            class="dh-clip clip"
            data-start="0"
            data-duration="4"
            data-track-index="0"
          >
            <div class="dh-card">
              <div class="dh-sweep" aria-hidden="true"></div>
              <div class="dh-label"></div>
            </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 card = root.querySelector(".dh-card");
              var sweep = root.querySelector(".dh-sweep");
              var label = root.querySelector(".dh-label");
              var vars =
                window.__hyperframes && window.__hyperframes.getVariables
                  ? window.__hyperframes.getVariables()
                  : {};

              var text = vars.text == null ? "Always alive" : String(vars.text);
              var intensity = vars.intensity === "whisper" ? "whisper" : "standard";
              var amplitudes = {
                whisper: { rotation: 0.24, scale: 0.006, sweep: 30, light: 0.04 },
                standard: { rotation: 0.6, scale: 0.015, sweep: 42, light: 0.08 },
              };
              var motion = amplitudes[intensity];

              label.textContent = text;

              var TAU = Math.PI * 2;
              var duration = Math.max(0.001, parseFloat(root.dataset.duration || "4"));
              var state = { phase: 0 };

              function renderPose() {
                // Literal phase zero at the endpoint removes floating point
                // residue from Math.sin(2 * PI) and makes the seam exact.
                var phase = state.phase === TAU ? 0 : state.phase;
                var rotation = Math.sin(phase + Math.PI / 6) * motion.rotation;
                var scale = 1 + Math.sin(phase + Math.PI / 2) * motion.scale;
                var sweepX = Math.sin(phase - Math.PI / 2) * motion.sweep;
                var sweepOpacity = 0.12 + Math.sin(phase + Math.PI / 3) * motion.light;

                gsap.set(card, { rotation: rotation, scale: scale });
                gsap.set(sweep, {
                  x: sweepX + "cqw",
                  rotation: 14,
                  opacity: sweepOpacity,
                });
              }

              var tl = gsap.timeline({ paused: true });

              // HOLD: uniform phase travel drives only whole-cycle sine motion.
              tl.to(state, { phase: TAU, duration: duration, ease: "none", onUpdate: renderPose }, 0);

              renderPose();
              tl.seek(0);
              window.__timelines = window.__timelines || {};
              window.__timelines["drift-hold"] = tl;
            })();
          </script>
        </div>
      </template>
    </body>
  </html>
  ```
</Accordion>

Tagged `motion-primitive` `camera` `ambient` `drift` `hold` `loopable`.

## 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

- [Aurora Drift](/catalog/components/aurora-drift.md)
- [Background Emphasis Type](/catalog/components/mk-emphasis-type.md)
- [Scroll Camera Story](/catalog/components/scroll-camera-story.md)
