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

# CTA Close

> A display-scale action line lands per word and fills the frame with air, one generous CTA capsule pops beneath it with a single overshoot, and the finished close holds completely still.

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

## Install

<InstallCommand command="npx hyperframes add cta-close" />

That writes one file: `compositions/components/cta-close.html`.

## Paste it into your composition

Open `compositions/components/cta-close.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                                                                                           |
| -------------- | ---------------- | ------------------------- | ------------------------------------------------------------------------------------------------------ |
| `action_line`  | `Make it happen` | string                    | Two to four word action that closes the film.                                                          |
| `button_label` | `Start now`      | string                    | Text displayed inside the single CTA capsule.                                                          |
| `accent`       | `green`          | `green`, `blue`, `violet` | Contract color used by the CTA capsule.                                                                |
| `exit`         | `none`           | `none`, `fade`, `up`      | Optional departure. Default none: the lockup holds until the frame cuts (this primitive closes films). |

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="cta-close"
  data-composition-src="compositions/components/cta-close.html"
  data-variable-values='{"action_line":"Make it happen","button_label":"Start now","accent":"green","exit":"none"}'
></div>
```

## Source

<Accordion title={`cta-close.html`}>
  ```html theme={null}
  <!doctype html>
  <!--
    cta-close: HyperFrames video primitive (call to action / close)

    The action-only close. A display-scale action line lands per word, sized by
    a character-aware fit so it fills 70 to 85 percent of the frame width with
    real air above and below. One generous button capsule pops beneath it with
    a single restrained overshoot, then the finished lockup holds dead still
    until the frame cuts. Monotone: ink on ground, accent only on the capsule.

    Variables:
      action_line: two to four word closing action
      button_label: capsule label
      accent: green, blue, or violet capsule color
      exit: none, fade, or up (default none; this primitive closes films)

    Envelope:
      IN_BASE = 1.32s, per-word landing followed by the capsule pop
      HOLD = the rest of D, completely still
      OUT = none by default; 0.45s lockup departure when exit is fade or up
      If D is shorter than the fixed phases, they compress to fit. The timeline
      is never time-scaled.

    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 literal cta-close key.
  -->
  <html
    lang="en"
    data-composition-id="cta-close"
    data-composition-duration="3.5"
    data-composition-variables='[
      { "id": "action_line", "type": "string", "role": "content", "label": "Action line", "description": "Two to four word action that closes the film.", "default": "Make it happen" },
      { "id": "button_label", "type": "string", "role": "content", "label": "Button label", "description": "Text displayed inside the single CTA capsule.", "default": "Start now" },
      { "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Contract color used by the CTA capsule.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
      { "id": "exit", "type": "enum", "role": "timing", "label": "Exit", "description": "Optional departure. Default none: the lockup holds until the frame cuts (this primitive closes films).", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Up" }] }
    ]'
  >
    <head>
      <meta charset="UTF-8" />
      <title>CTA Close</title>
    </head>
    <body>
      <template>
        <div id="root" data-composition-id="cta-close" data-duration="3.5" 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;
            }

            .cc-clip {
              position: absolute;
              inset: 0;
              display: grid;
              place-items: center;
              overflow: hidden;
              background: var(--bg, #0b0c0e);
            }

            .cc-lockup {
              display: flex;
              flex-direction: column;
              align-items: center;
              gap: 7cqh;
              max-width: 96cqw;
              text-align: center;
            }

            .cc-action {
              margin: 0;
              color: var(--fg, #f8fafc);
              font-family: var(--font-display, Inter, system-ui, sans-serif);
              font-size: var(--cc-action-size, min(10.4cqw, 30cqh));
              font-weight: 600;
              line-height: 1.02;
              letter-spacing: -0.035em;
              white-space: nowrap;
            }

            .cc-w {
              display: inline-block;
              will-change: transform, opacity;
            }

            .cc-button {
              margin: 0;
              padding: 2.9cqh 5cqw;
              overflow: hidden;
              border: 0;
              border-radius: 999px;
              background: var(--cc-accent);
              color: var(--bg, #0b0c0e);
              font-family: var(--font-body, Inter, system-ui, sans-serif);
              font-size: var(--cc-button-size, min(3.4cqw, 6cqh));
              font-weight: 600;
              line-height: 1;
              letter-spacing: -0.01em;
              white-space: nowrap;
              transform-origin: 50% 50%;
              will-change: transform, opacity;
            }
          </style>

          <div
            id="cta-close-clip"
            class="cc-clip clip"
            data-start="0"
            data-duration="3.5"
            data-track-index="0"
          >
            <div class="cc-lockup">
              <h2 class="cc-action"></h2>
              <button class="cc-button" type="button" tabindex="-1"></button>
            </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 lockup = root.querySelector(".cc-lockup");
              var actionLine = root.querySelector(".cc-action");
              var button = root.querySelector(".cc-button");
              var vars =
                window.__hyperframes && window.__hyperframes.getVariables
                  ? window.__hyperframes.getVariables()
                  : {};

              var actionText =
                vars.action_line == null
                  ? "Make it happen"
                  : String(vars.action_line).trim().replace(/\s+/g, " ");
              var buttonText =
                vars.button_label == null
                  ? "Start now"
                  : String(vars.button_label).trim().replace(/\s+/g, " ");
              var accentColors = {
                green: "var(--brand, #71f5a7)",
                blue: "var(--accent, #61a8ff)",
                violet: "var(--accent-2, #c5a3ff)",
              };
              var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
                ? vars.accent
                : "green";
              var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";

              // The line lands per word: one span per word, natural spaces kept
              // between them so the display tracking never crushes word gaps.
              actionLine.setAttribute("aria-label", actionText);
              var words = actionText ? actionText.split(" ") : [];
              words.forEach(function (word, index) {
                if (index > 0) actionLine.appendChild(document.createTextNode(" "));
                var span = document.createElement("span");
                span.className = "cc-w";
                span.setAttribute("aria-hidden", "true");
                span.textContent = word;
                actionLine.appendChild(span);
              });
              var wordEls = actionLine.querySelectorAll(".cc-w");
              button.textContent = buttonText;
              root.style.setProperty("--cc-accent", accentColors[accent]);

              // Character-count fitting is deterministic before the template is
              // laid out. The 0.47em advance estimate lands common display faces
              // at 70 to 85 percent of the frame width; short lines cap on
              // height instead so two-word closes stay monumental without
              // touching the edges.
              var actionCharacters = Math.max(1, Array.from(actionText).length);
              var actionSize = Math.min(24, 76 / (actionCharacters * 0.47));
              var buttonCharacters = Math.max(1, Array.from(buttonText).length);
              var buttonSize = Math.min(3.5, 50 / (buttonCharacters * 0.5));
              root.style.setProperty(
                "--cc-action-size",
                "min(" + actionSize.toFixed(3) + "cqw, 30cqh)",
              );
              root.style.setProperty(
                "--cc-button-size",
                "min(" + buttonSize.toFixed(3) + "cqw, 6cqh)",
              );

              var IN_BASE = 1.32;
              var OUT_BASE = exit === "none" ? 0 : 0.45;
              var duration = Math.max(0.001, parseFloat(root.dataset.duration || "3.5"));
              var envelopeScale = Math.min(1, duration / (IN_BASE + OUT_BASE));
              var WORDS_AT = 0.06 * envelopeScale;
              var WORD_DURATION = 0.62 * envelopeScale;
              var WORD_STAGGER = 0.1 * envelopeScale;
              var BUTTON_AT = 0.72 * envelopeScale;
              var BUTTON_DURATION = 0.6 * envelopeScale;
              var BUTTON_FADE = 0.22 * envelopeScale;
              var OUT = OUT_BASE * envelopeScale;
              var OUT_START = duration - OUT;

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

              // IN, phase one: the action line lands per word at display scale.
              tl.fromTo(
                wordEls,
                { opacity: 0, y: "8cqh" },
                {
                  opacity: 1,
                  y: 0,
                  duration: WORD_DURATION,
                  ease: "power3.out",
                  stagger: WORD_STAGGER,
                },
                WORDS_AT,
              );

              // IN, phase two: the capsule pops beneath with ONE restrained
              // overshoot (back.out), a real button under a monumental line.
              tl.fromTo(
                button,
                { scale: 0.85, y: "3cqh" },
                { scale: 1, y: 0, duration: BUTTON_DURATION, ease: "back.out(1.5)" },
                BUTTON_AT,
              );
              tl.fromTo(
                button,
                { opacity: 0 },
                { opacity: 1, duration: BUTTON_FADE, ease: "power2.out" },
                BUTTON_AT,
              );

              // HOLD: dead still. The empty set pins the timeline to the full
              // mount duration so seeks inside the hold land on the held pose.
              tl.set({}, {}, duration);

              // OUT: optional departure; exit none holds the still lockup
              // until the frame cuts (this primitive closes films).
              if (exit === "fade") {
                tl.to(lockup, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
              } else if (exit === "up") {
                tl.to(
                  lockup,
                  { opacity: 0, y: "-5cqh", duration: OUT, ease: "power2.in" },
                  OUT_START,
                );
              }

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

Tagged `motion-primitive` `ui-props` `cta` `end-card` `close` `ask`.

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

- [Logo Brand Close](/catalog/components/logo-brand-close.md)
- [CTA Lockup](/catalog/components/cta-lockup.md)
- [Editing existing videos](/prompting/editing-existing-videos.md)
