CTA JS behaviour

Image-backed CTA

A CTA banner over a hand-drawn scenic SVG — setting sun, layered hills and a converging grid — under a dark overlay; a bright headline, three small stats and a glass button, with a subtle parallax drifting the layers under your pointer.

Documentation

Real scenarios

The component as it is used in a product — not a specimen grid.

Launch. Watch. Learn.

The dusk between shipping and knowing — Meridian lights up every rollout as it crosses your fleet.

99.99%relay uptime
38msmedian latency · Frankfurt
4,200active teams
Start free

Move the pointer over the scene — the stars, sun and hills each carry their own factor and drift against the cursor; under prefers-reduced-motion everything holds still.

Important props

Important props
Prop Type Default What it does
parallax px '±4 … ±22' Each layer carries its own factor — stars 4, sun 10, hills 16 and 22px — and they counter-move with the pointer so the scene reads as depth.
overlay color '#0a0c17 · 46–78%' The gradient dark overlay, heavier at the bottom; it guarantees the bright copy’s contrast.
stats count '3' Three small stats under the headline — big figure, muted label — building trust before the click.
glass background 'blur(14px) · 18% white' The glass button over the scene; the blur lets the backdrop through and it brightens a touch on hover.

Snippet

<section class="ctim" x-data="{ x: 0, y: 0 }"
x-on:pointermove="const r = $el.getBoundingClientRect();
    x = ((($event.clientX - r.left) / r.width) * 2 - 1).toFixed(3);
    y = ((($event.clientY - r.top) / r.height) * 2 - 1).toFixed(3)"
x-on:pointerleave="x = 0; y = 0"
:style="'--ctim-x:' + x + '; --ctim-y:' + y">
<svg class="ctim-art" viewBox="0 0 960 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<defs>
<linearGradient id="ctim-sky" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#1e1a4a"/><stop offset=".55" stop-color="#7c3aed"/><stop offset="1" stop-color="#f472b6"/>
</linearGradient>
</defs>
<rect width="960" height="400" fill="url(#ctim-sky)"/>
<g class="ctim-sun"><circle cx="600" cy="190" r="58" fill="#ffd68a"/></g>
<path class="ctim-hill-b" d="M0 292 C160 232 300 268 460 260 C640 250 760 286 960 268 V400 H0 Z" fill="#3b31a3"/>
<path class="ctim-hill-f" d="M0 340 C200 296 380 330 560 322 C740 314 840 336 960 326 V400 H0 Z" fill="#1e1a4a"/>
</svg>
<div class="ctim-body">
<h3>Launch. Watch. Learn.</h3>
<div class="ctim-stats">
<div><b>99.99%</b><small>relay uptime</small></div>
</div>
<a class="ctim-glass" href="/signup">Start free</a>
</div>
</section>

<style>
.ctim { position: relative; overflow: clip; border-radius: 24px; color: #fff; }
.ctim::after { content: ''; position: absolute; inset: 0;
               background: linear-gradient(to top, #0a0c17c7, #0a0c1775 55%, #0a0c1740); }
.ctim-body { position: relative; z-index: 1; display: grid; gap: 1.25rem; justify-items: center;
             padding: 4rem 1.5rem; text-align: center; }
.ctim-sun { transform: translate(calc(var(--ctim-x, 0) * 10px), calc(var(--ctim-y, 0) * 6px));
            transition: transform .3s ease-out; }
.ctim-hill-f { transform: translate(calc(var(--ctim-x, 0) * -22px), 0); transition: transform .3s ease-out; }
.ctim-glass { padding: .9rem 1.75rem; border-radius: 999px; background: #ffffff2e;
              backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px #ffffff59; color: #fff; }
</style>
// app/Pages/Launch.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import ImageCta from '@/components/ImageCta';

export default function Launch() {
  return (
    <NabuXUIProvider locale="en" linkComponent={Link}>
      <main className="nx-page">
        <ImageCta />
      </main>
    </NabuXUIProvider>
  );
}
// ImageCta.jsx — scenic SVG backdrop, dark overlay, pointer parallax
import '@nabuxai/ui-core/css';

export default function ImageCta() {
  // Pointer position becomes two CSS vars; each layer reads them
  // with its own factor, so the scene gains depth for free.
  const track = (e) => {
    const el = e.currentTarget;
    const r = el.getBoundingClientRect();
    el.style.setProperty('--ctim-x', (((e.clientX - r.left) / r.width) * 2 - 1).toFixed(3));
    el.style.setProperty('--ctim-y', (((e.clientY - r.top) / r.height) * 2 - 1).toFixed(3));
  };
  const reset = (e) => {
    e.currentTarget.style.setProperty('--ctim-x', 0);
    e.currentTarget.style.setProperty('--ctim-y', 0);
  };

  return (
    <>
      <style>{`
        .ctim { position: relative; overflow: clip; border-radius: 1.5rem; color: #fff; }
        .ctim::after { content: ''; position: absolute; inset: 0; pointer-events: none;
                       background: linear-gradient(to top, #0a0c17c7, #0a0c1775 55%, #0a0c1740); }
        .ctim-art { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; }
        .ctim .ctim-stars, .ctim .ctim-sun, .ctim .ctim-hill-b, .ctim .ctim-hill-f { transition: transform .3s ease-out; }
        .ctim .ctim-stars { transform: translate(calc(var(--ctim-x, 0) * 4px), calc(var(--ctim-y, 0) * 3px)); }
        .ctim .ctim-sun { transform: translate(calc(var(--ctim-x, 0) * 10px), calc(var(--ctim-y, 0) * 6px)); }
        .ctim .ctim-hill-b { transform: translate(calc(var(--ctim-x, 0) * -16px), 0); }
        .ctim .ctim-hill-f { transform: translate(calc(var(--ctim-x, 0) * -22px), 0); }
        .ctim-body { position: relative; z-index: 1; display: grid; gap: 1.25rem; justify-items: center;
                     padding: clamp(3.5rem, 9vw, 5.5rem) 1.5rem; text-align: center; }
        .ctim-title { margin: 0; max-inline-size: 20ch; font: 800 clamp(1.8rem, 4.2vw, 2.8rem)/1.15
                      'Bricolage Grotesque', Inter, sans-serif; letter-spacing: -.02em; text-wrap: balance; }
        .ctim-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 2.5rem; }
        .ctim-stats div { display: grid; gap: .2rem; }
        .ctim-stats b { font-size: 1.5rem; letter-spacing: -.02em; }
        .ctim-stats small { color: #ffffffb3; }
        .ctim-glass { display: inline-flex; align-items: center; gap: .5rem; block-size: 3rem; padding-inline: 1.6rem;
                      border-radius: 999px; background: #ffffff2e; backdrop-filter: blur(14px);
                      -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px #ffffff59; color: #fff;
                      font-weight: 700; text-decoration: none; transition: background-color .18s, translate .18s; }
        .ctim-glass:hover { background: #ffffff40; translate: 0 -2px; }
        @media (prefers-reduced-motion: reduce) {
          .ctim .ctim-stars, .ctim .ctim-sun, .ctim .ctim-hill-b, .ctim .ctim-hill-f { transition: none; transform: none; }
          .ctim-glass { transition: none; }
        }
      `}</style>
      <section class="ctim" onPointerMove={track} onPointerLeave={reset}>
        <svg class="ctim-art" viewBox="0 0 960 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
          <defs>
            <linearGradient id="ctim-sky" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stopColor="#1e1a4a" /><stop offset=".55" stopColor="#7c3aed" /><stop offset="1" stopColor="#f472b6" />
            </linearGradient>
          </defs>
          <rect width="960" height="400" fill="url(#ctim-sky)" />
          <g class="ctim-stars" fill="#fff">
            <circle cx="120" cy="60" r="2" opacity=".8" /><circle cx="320" cy="110" r="1.5" opacity=".6" />
            <circle cx="820" cy="52" r="2" opacity=".7" /><circle cx="700" cy="130" r="1.5" opacity=".5" />
          </g>
          <g class="ctim-sun">
            <circle cx="600" cy="190" r="96" fill="#ffd68a" opacity=".22" />
            <circle cx="600" cy="190" r="58" fill="#ffd68a" />
          </g>
          <path class="ctim-hill-b" d="M0 292 C160 232 300 268 460 260 C640 250 760 286 960 268 V400 H0 Z" fill="#3b31a3" />
          <path class="ctim-hill-f" d="M0 340 C200 296 380 330 560 322 C740 314 840 336 960 326 V400 H0 Z" fill="#1e1a4a" />
        </svg>
        <div class="ctim-body">
          <h3 class="ctim-title">Launch. Watch. Learn.</h3>
          <div class="ctim-stats">
            <div><b>99.99%</b><small>relay uptime</small></div>
            <div><b>38ms</b><small>median latency · Frankfurt</small></div>
            <div><b>4,200</b><small>active teams</small></div>
          </div>
          <a class="ctim-glass" href="/signup">Start free →</a>
        </div>
      </section>
    </>
  );
}
<!-- ImageCta.vue — scenic SVG backdrop, dark overlay, pointer parallax -->
<script setup lang="ts">
import '@nabuxai/ui-core/css';

// Pointer position becomes two CSS vars; each layer reads them
// with its own factor, so the scene gains depth for free.
const track = (e: PointerEvent) => {
  const el = e.currentTarget as HTMLElement;
  const r = el.getBoundingClientRect();
  el.style.setProperty('--ctim-x', (((e.clientX - r.left) / r.width) * 2 - 1).toFixed(3));
  el.style.setProperty('--ctim-y', (((e.clientY - r.top) / r.height) * 2 - 1).toFixed(3));
};
const reset = (e: PointerEvent) => {
  const el = e.currentTarget as HTMLElement;
  el.style.setProperty('--ctim-x', '0');
  el.style.setProperty('--ctim-y', '0');
};
</script>

<template>
  <section class="ctim" @pointermove="track" @pointerleave="reset">
    <svg class="ctim-art" viewBox="0 0 960 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
      <defs>
        <linearGradient id="ctim-sky" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stop-color="#1e1a4a" /><stop offset=".55" stop-color="#7c3aed" /><stop offset="1" stop-color="#f472b6" />
        </linearGradient>
      </defs>
      <rect width="960" height="400" fill="url(#ctim-sky)" />
      <g class="ctim-stars" fill="#fff">
        <circle cx="120" cy="60" r="2" opacity=".8" /><circle cx="320" cy="110" r="1.5" opacity=".6" />
        <circle cx="820" cy="52" r="2" opacity=".7" /><circle cx="700" cy="130" r="1.5" opacity=".5" />
      </g>
      <g class="ctim-sun">
        <circle cx="600" cy="190" r="96" fill="#ffd68a" opacity=".22" />
        <circle cx="600" cy="190" r="58" fill="#ffd68a" />
      </g>
      <path class="ctim-hill-b" d="M0 292 C160 232 300 268 460 260 C640 250 760 286 960 268 V400 H0 Z" fill="#3b31a3" />
      <path class="ctim-hill-f" d="M0 340 C200 296 380 330 560 322 C740 314 840 336 960 326 V400 H0 Z" fill="#1e1a4a" />
    </svg>
    <div class="ctim-body">
      <h3 class="ctim-title">Launch. Watch. Learn.</h3>
      <div class="ctim-stats">
        <div><b>99.99%</b><small>relay uptime</small></div>
        <div><b>38ms</b><small>median latency · Frankfurt</small></div>
        <div><b>4,200</b><small>active teams</small></div>
      </div>
      <a class="ctim-glass" href="/signup">Start free →</a>
    </div>
  </section>
</template>

<style scoped>
.ctim { position: relative; overflow: clip; border-radius: 1.5rem; color: #fff; }
.ctim::after { content: ''; position: absolute; inset: 0; pointer-events: none;
               background: linear-gradient(to top, #0a0c17c7, #0a0c1775 55%, #0a0c1740); }
.ctim-art { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; }
.ctim :deep(.ctim-stars), .ctim :deep(.ctim-sun), .ctim :deep(.ctim-hill-b), .ctim :deep(.ctim-hill-f) { transition: transform .3s ease-out; }
.ctim :deep(.ctim-stars) { transform: translate(calc(var(--ctim-x, 0) * 4px), calc(var(--ctim-y, 0) * 3px)); }
.ctim :deep(.ctim-sun) { transform: translate(calc(var(--ctim-x, 0) * 10px), calc(var(--ctim-y, 0) * 6px)); }
.ctim :deep(.ctim-hill-b) { transform: translate(calc(var(--ctim-x, 0) * -16px), 0); }
.ctim :deep(.ctim-hill-f) { transform: translate(calc(var(--ctim-x, 0) * -22px), 0); }
.ctim-body { position: relative; z-index: 1; display: grid; gap: 1.25rem; justify-items: center;
             padding: clamp(3.5rem, 9vw, 5.5rem) 1.5rem; text-align: center; }
.ctim-title { margin: 0; max-inline-size: 20ch; font: 800 clamp(1.8rem, 4.2vw, 2.8rem)/1.15
              'Bricolage Grotesque', Inter, sans-serif; letter-spacing: -.02em; text-wrap: balance; }
.ctim-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 2.5rem; }
.ctim-stats div { display: grid; gap: .2rem; }
.ctim-stats b { font-size: 1.5rem; letter-spacing: -.02em; }
.ctim-stats small { color: #ffffffb3; }
.ctim-glass { display: inline-flex; align-items: center; gap: .5rem; block-size: 3rem; padding-inline: 1.6rem;
              border-radius: 999px; background: #ffffff2e; backdrop-filter: blur(14px);
              -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px #ffffff59; color: #fff;
              font-weight: 700; text-decoration: none; transition: background-color .18s, translate .18s; }
.ctim-glass:hover { background: #ffffff40; translate: 0 -2px; }
@media (prefers-reduced-motion: reduce) {
  .ctim :deep(.ctim-stars), .ctim :deep(.ctim-sun), .ctim :deep(.ctim-hill-b), .ctim :deep(.ctim-hill-f) { transition: none; transform: none; }
  .ctim-glass { transition: none; }
}
</style>
<!-- ImageCta.svelte — scenic SVG backdrop, dark overlay, pointer parallax -->
<script lang="ts">
  import '@nabuxai/ui-core/css';

  // Pointer position becomes two CSS vars; each layer reads them
  // with its own factor, so the scene gains depth for free.
  const track = (e: PointerEvent) => {
    const el = e.currentTarget as HTMLElement;
    const r = el.getBoundingClientRect();
    el.style.setProperty('--ctim-x', (((e.clientX - r.left) / r.width) * 2 - 1).toFixed(3));
    el.style.setProperty('--ctim-y', (((e.clientY - r.top) / r.height) * 2 - 1).toFixed(3));
  };
  const reset = (e: PointerEvent) => {
    const el = e.currentTarget as HTMLElement;
    el.style.setProperty('--ctim-x', '0');
    el.style.setProperty('--ctim-y', '0');
  };
</script>

<section class="ctim" onpointermove={track} onpointerleave={reset}>
  <svg class="ctim-art" viewBox="0 0 960 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
    <defs>
      <linearGradient id="ctim-sky" x1="0" y1="0" x2="0" y2="1">
        <stop offset="0" stop-color="#1e1a4a" /><stop offset=".55" stop-color="#7c3aed" /><stop offset="1" stop-color="#f472b6" />
      </linearGradient>
    </defs>
    <rect width="960" height="400" fill="url(#ctim-sky)" />
    <g class="ctim-stars" fill="#fff">
      <circle cx="120" cy="60" r="2" opacity=".8" /><circle cx="320" cy="110" r="1.5" opacity=".6" />
      <circle cx="820" cy="52" r="2" opacity=".7" /><circle cx="700" cy="130" r="1.5" opacity=".5" />
    </g>
    <g class="ctim-sun">
      <circle cx="600" cy="190" r="96" fill="#ffd68a" opacity=".22" />
      <circle cx="600" cy="190" r="58" fill="#ffd68a" />
    </g>
    <path class="ctim-hill-b" d="M0 292 C160 232 300 268 460 260 C640 250 760 286 960 268 V400 H0 Z" fill="#3b31a3" />
    <path class="ctim-hill-f" d="M0 340 C200 296 380 330 560 322 C740 314 840 336 960 326 V400 H0 Z" fill="#1e1a4a" />
  </svg>
  <div class="ctim-body">
    <h3 class="ctim-title">Launch. Watch. Learn.</h3>
    <div class="ctim-stats">
      <div><b>99.99%</b><small>relay uptime</small></div>
      <div><b>38ms</b><small>median latency · Frankfurt</small></div>
      <div><b>4,200</b><small>active teams</small></div>
    </div>
    <a class="ctim-glass" href="/signup">Start free →</a>
  </div>
</section>

<style>
.ctim { position: relative; overflow: clip; border-radius: 1.5rem; color: #fff; }
.ctim::after { content: ''; position: absolute; inset: 0; pointer-events: none;
               background: linear-gradient(to top, #0a0c17c7, #0a0c1775 55%, #0a0c1740); }
.ctim-art { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; }
.ctim .ctim-stars, .ctim .ctim-sun, .ctim .ctim-hill-b, .ctim .ctim-hill-f { transition: transform .3s ease-out; }
.ctim .ctim-stars { transform: translate(calc(var(--ctim-x, 0) * 4px), calc(var(--ctim-y, 0) * 3px)); }
.ctim .ctim-sun { transform: translate(calc(var(--ctim-x, 0) * 10px), calc(var(--ctim-y, 0) * 6px)); }
.ctim .ctim-hill-b { transform: translate(calc(var(--ctim-x, 0) * -16px), 0); }
.ctim .ctim-hill-f { transform: translate(calc(var(--ctim-x, 0) * -22px), 0); }
.ctim-body { position: relative; z-index: 1; display: grid; gap: 1.25rem; justify-items: center;
             padding: clamp(3.5rem, 9vw, 5.5rem) 1.5rem; text-align: center; }
.ctim-title { margin: 0; max-inline-size: 20ch; font: 800 clamp(1.8rem, 4.2vw, 2.8rem)/1.15
              'Bricolage Grotesque', Inter, sans-serif; letter-spacing: -.02em; text-wrap: balance; }
.ctim-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 2.5rem; }
.ctim-stats div { display: grid; gap: .2rem; }
.ctim-stats b { font-size: 1.5rem; letter-spacing: -.02em; }
.ctim-stats small { color: #ffffffb3; }
.ctim-glass { display: inline-flex; align-items: center; gap: .5rem; block-size: 3rem; padding-inline: 1.6rem;
              border-radius: 999px; background: #ffffff2e; backdrop-filter: blur(14px);
              -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px #ffffff59; color: #fff;
              font-weight: 700; text-decoration: none; transition: background-color .18s, translate .18s; }
.ctim-glass:hover { background: #ffffff40; translate: 0 -2px; }
@media (prefers-reduced-motion: reduce) {
  .ctim .ctim-stars, .ctim .ctim-sun, .ctim .ctim-hill-b, .ctim .ctim-hill-f { transition: none; transform: none; }
  .ctim-glass { transition: none; }
}
</style>