Kinetic type
JS behaviour
3D word cycle
The headline’s key word flips on its X axis through a four-word loop; the container eases its width to each newcomer, hover holds the cycle and the replay button spins it from the top.
Real scenarios
The component as it is used in a product — not a specimen grid.
The headline word that never stands still
The keyword flips out at rotateX(90°), swaps under the fold and swings back in from −90°, while a hidden same-font span measures the incoming word so the slot width eases to it. Hover holds the loop, the dots jump straight to a word, and off screen the cycle rests.
NABUXUI · DESIGNOPS
Ship your design system — than ever.
Hover to hold · 2.4s per word
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| words | string[] | '4 items' | The four loop words; each is pre-measured with a hidden same-font span before it shows. |
| perspective | px | '600' | The 3D depth on the parent; without it the rotateX flip flattens out. |
| cadence | ms | '2400' | The loop step; hovering the headline holds the timer and it resumes when the pointer leaves. |
| width-ease | transition | '.42s cubic-bezier(.3,.7,.2,1)' | The container width travels with each word so the sentence never jumps; it snaps seamlessly under reduced motion. |
Snippet
{{-- resources/views/demos/components/kinetic/rotate-cycle-3d.blade.php --}}
<h2 class="rc3" x-data="{
words: {{ json_encode(['faster', 'together', 'anywhere', 'wiser'], JSON_UNESCAPED_UNICODE) }},
i: 0, t: null, t2: null, io: null,
swap() {
const word = this.$refs.word;
word.dataset.state = 'out';
this.t2 = setTimeout(() => {
this.i = (this.i + 1) % this.words.length;
word.dataset.state = 'in';
requestAnimationFrame(() => requestAnimationFrame(() => (word.dataset.state = 'show')));
this.fit();
}, 260);
},
fit() {
this.$refs.ghost.textContent = this.words[this.i];
this.$refs.slot.style.inlineSize = Math.ceil(this.$refs.ghost.getBoundingClientRect().width) + 'px';
},
start() { this.stop(); this.t = setInterval(() => this.swap(), 2400); },
stop() { clearInterval(this.t); clearTimeout(this.t2); },
init() {
this.fit();
if (!matchMedia('(prefers-reduced-motion: reduce)').matches) {
this.io = new IntersectionObserver((e) => (e[0].isIntersecting ? this.start() : this.stop()));
this.io.observe(this.$el);
}
},
destroy() { this.stop(); if (this.io) this.io.disconnect(); },
}"
x-on:pointerenter="stop()" x-on:pointerleave="start()">
Ship your design system
<span class="rc3-stage" x-ref="slot"><span class="rc3-word" x-ref="word" x-text="words[i]"></span></span>
<span class="rc3-ghost" x-ref="ghost" aria-hidden="true"></span>
</h2>
<button type="button" x-on:click="i = 0; fit()">Replay</button>
<style>
.rc3-stage { display: inline-block; perspective: 600px; transition: inline-size .42s cubic-bezier(.3,.7,.2,1); }
.rc3-word { display: inline-block; transform-origin: 50% 100%; transition: transform .26s ease, opacity .26s ease; }
.rc3-word[data-state='out'] { transform: rotateX(90deg); opacity: 0; }
.rc3-word[data-state='in'] { transform: rotateX(-90deg); opacity: 0; transition: none; }
.rc3-ghost { position: absolute; visibility: hidden; white-space: nowrap; }
</style>
// app/Pages/Landing.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 HeroCycle from '@/components/HeroCycle';
export default function Landing() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<HeroCycle />
</main>
</NabuXUIProvider>
);
}
// HeroCycle.jsx — the headline keyword flipping through a 3D word loop
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import '@nabuxai/ui-core/css';
const WORDS = ['faster', 'together', 'anywhere', 'wiser'];
export default function HeroCycle() {
const [i, setI] = useState(0);
const [state, setState] = useState('show');
const [width, setWidth] = useState(0);
const ghost = useRef(null);
const word = useRef(null);
// Measure the incoming word with a hidden same-font span.
useLayoutEffect(() => {
if (ghost.current) setWidth(Math.ceil(ghost.current.getBoundingClientRect().width));
}, [i]);
// The loop: out on X, swap under the fold, back in — off screen it rests.
useEffect(() => {
if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
const tick = setInterval(() => {
setState('out');
setTimeout(() => { setI((n) => (n + 1) % WORDS.length); setState('in');
requestAnimationFrame(() => requestAnimationFrame(() => setState('show'))); }, 260);
}, 2400);
const io = new IntersectionObserver(([e]) => e.isIntersecting ? null : clearInterval(tick));
io.observe(word.current);
return () => { clearInterval(tick); io.disconnect(); };
}, []);
return (
<>
<style>{`
.rc3 { margin: 0; font: 800 clamp(1.8rem, 6vw, 3.4rem)/1.25 'IBM Plex Sans', sans-serif; }
.rc3-stage { display: inline-block; perspective: 600px; white-space: nowrap;
transition: inline-size .42s cubic-bezier(.3,.7,.2,1); }
.rc3-word { display: inline-block; transform-origin: 50% 100%;
transition: transform .26s ease, opacity .26s ease; }
.rc3-word[data-state='out'] { transform: rotateX(90deg); opacity: 0; }
.rc3-word[data-state='in'] { transform: rotateX(-90deg); opacity: 0; transition: none; }
.rc3-ghost { position: absolute; visibility: hidden; white-space: nowrap; }
`}</style>
<h2 className="rc3" onPointerEnter={() => clearInterval(undefined)}>
Ship your design system{' '}
<span className="rc3-stage" ref={word} style={{ inlineSize: width ? width + 'px' : undefined }}>
<span className="rc3-word" data-state={state} aria-live="polite">{WORDS[i]}</span>
</span>
<span className="rc3-ghost" ref={ghost} aria-hidden="true">{WORDS[i]}</span>
</h2>
</>
);
}
<!-- HeroCycle.vue — the headline keyword flipping through a 3D word loop -->
<script setup>
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import '@nabuxai/ui-core/css';
const WORDS = ['faster', 'together', 'anywhere', 'wiser'];
const i = ref(0);
const state = ref('show');
const width = ref(0);
const ghost = ref(null);
let t = null, t2 = null, io = null;
async function fit() {
await nextTick();
width.value = Math.ceil(ghost.value.getBoundingClientRect().width);
}
function swap() {
state.value = 'out';
t2 = setTimeout(async () => {
i.value = (i.value + 1) % WORDS.length;
state.value = 'in';
await fit();
requestAnimationFrame(() => requestAnimationFrame(() => (state.value = 'show')));
}, 260);
}
function start() { stop(); t = setInterval(swap, 2400); }
function stop() { clearInterval(t); clearTimeout(t2); }
onMounted(() => {
fit();
if (!matchMedia('(prefers-reduced-motion: reduce)').matches) {
io = new IntersectionObserver(([e]) => (e.isIntersecting ? start() : stop()));
io.observe(ghost.value.parentElement);
}
});
onBeforeUnmount(() => { stop(); io?.disconnect(); });
</script>
<template>
<h2 class="rc3" @pointerenter="stop" @pointerleave="start">
Ship your design system
<span class="rc3-stage" :style="{ inlineSize: width ? width + 'px' : undefined }">
<span class="rc3-word" :data-state="state" aria-live="polite">{{ WORDS[i] }}</span>
</span>
<span class="rc3-ghost" ref="ghost" aria-hidden="true">{{ WORDS[i] }}</span>
</h2>
</template>
<style scoped>
.rc3 { margin: 0; font: 800 clamp(1.8rem, 6vw, 3.4rem)/1.25 'IBM Plex Sans', sans-serif; }
.rc3-stage { display: inline-block; perspective: 600px; white-space: nowrap;
transition: inline-size .42s cubic-bezier(.3,.7,.2,1); }
.rc3-word { display: inline-block; transform-origin: 50% 100%;
transition: transform .26s ease, opacity .26s ease; }
.rc3-word[data-state='out'] { transform: rotateX(90deg); opacity: 0; }
.rc3-word[data-state='in'] { transform: rotateX(-90deg); opacity: 0; transition: none; }
.rc3-ghost { position: absolute; visibility: hidden; white-space: nowrap; }
</style>
<!-- HeroCycle.svelte — the headline keyword flipping through a 3D word loop -->
<script>
import { onMount } from 'svelte';
import '@nabuxai/ui-core/css';
const WORDS = ['faster', 'together', 'anywhere', 'wiser'];
let i = $state(0);
let state = $state('show');
let width = $state(0);
let ghost;
let t = null, t2 = null, io = null;
function fit() { width = Math.ceil(ghost.getBoundingClientRect().width); }
function swap() {
state = 'out';
t2 = setTimeout(() => {
i = (i + 1) % WORDS.length;
state = 'in';
fit();
requestAnimationFrame(() => requestAnimationFrame(() => (state = 'show')));
}, 260);
}
function start() { stop(); t = setInterval(swap, 2400); }
function stop() { clearInterval(t); clearTimeout(t2); }
onMount(() => {
fit();
if (!matchMedia('(prefers-reduced-motion: reduce)').matches) {
io = new IntersectionObserver(([e]) => (e.isIntersecting ? start() : stop()));
io.observe(ghost.parentElement);
}
return () => { stop(); io?.disconnect(); };
});
</script>
<h2 class="rc3" onpointerenter={stop} onpointerleave={start}>
Ship your design system
<span class="rc3-stage" style={`inline-size:${width ? width + 'px' : 'auto'}`}>
<span class="rc3-word" data-state={state} aria-live="polite">{WORDS[i]}</span>
</span>
<span class="rc3-ghost" bind:this={ghost} aria-hidden="true">{WORDS[i]}</span>
</h2>
<style>
.rc3 { margin: 0; font: 800 clamp(1.8rem, 6vw, 3.4rem)/1.25 'IBM Plex Sans', sans-serif; }
.rc3-stage { display: inline-block; perspective: 600px; white-space: nowrap;
transition: inline-size .42s cubic-bezier(.3,.7,.2,1); }
.rc3-word { display: inline-block; transform-origin: 50% 100%;
transition: transform .26s ease, opacity .26s ease; }
.rc3-word[data-state='out'] { transform: rotateX(90deg); opacity: 0; }
.rc3-word[data-state='in'] { transform: rotateX(-90deg); opacity: 0; transition: none; }
.rc3-ghost { position: absolute; visibility: hidden; white-space: nowrap; }
</style>