Float and marquee
Objects hang in the air or a row of items scrolls past endlessly, adding life to a held scene.
Rendered video, with motion blur.
0.00 / 4.00 s
Live preview, driven by the code below. No motion blur.
What it does
Floating objects bob gently, each at its own phase; a marquee row slides past at a constant speed and wraps without a seam.
Curve
Sine: out and back
Values
S is the frame's short side, 1080 px at 1080p. Unmeasured inputs in the preview are illustrations, not rules.
| Fact | Value |
|---|---|
Purpose | Loop |
Acts on | Card, group |
Typical length | 3 to 5 s (90 to 150 frames at 30 fps), per float cycle; marquee runs the whole scene |
Caution | Never float text the viewer has to read, and keep marquee items legible. |
| Property | Value |
|---|---|
Float | Up and down 0.4 to 0.7% S (4 to 8 px) on a sine loop of 3 to 5 s, each object at a different phase |
Marquee | Constant linear speed of 3.7 to 7.4% S (40 to 80 px) a second, with a seamless wrap |
Export samples | 12; 1 when still |
Starting values from research. Measure against a reference before relying on them.
Code
ts
export const seg = (t: number, a: number, b: number) => Math.max(0, Math.min(1, (t - a) / (b - a)));
export const lerp = (a: number, b: number, k: number) => a + (b - a) * k;
export const out = (k: number) => (k >= 1 ? 1 : 1 - Math.pow(2, -10 * k));
export const io = (k: number) => (k < 0.5 ? 16 * k ** 5 : 1 - Math.pow(-2 * k + 2, 5) / 2);
export const inn = (k: number) => k * k * k;
export const cubicOut = (k: number) => 1 - Math.pow(1 - k, 3);
export const h = (i: number, j: number) => { const x = Math.sin(i * 127.1 + j * 311.7) * 43758.5453; return x - Math.floor(x); };
export const phase = (t: number, start = 0, duration = 0.6) => seg(t, start, start + duration);
export const easeInOut = (p: number) => p < 0.5 ? 4 * p ** 3 : 1 - (-2 * p + 2) ** 3 / 2;
export const float = (t: number, phaseShift: number, amplitude = 6, period = 4) => ({ y: amplitude * Math.sin(2 * Math.PI * t / period + phaseShift) });
export const marquee = (t: number, setWidth: number, speed = 60) => ({ x: -((t * speed) % setWidth) });Best practices
| Use it for | Avoid |
|---|---|
Floating cards in a held scene | Floating text the viewer has to read |
A row of customer or integration logos | Marquee items too fast or small to read |
Reduced motion: a simple opacity fade over 0.2 s.