Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011h6NB8JQtfPc6eRCefEzBB
107 lines
3.1 KiB
HTML
107 lines
3.1 KiB
HTML
<template id="particle-burst-template">
|
|
<div data-composition-id="particle-burst" data-width="1920" data-height="1080" data-duration="2">
|
|
<style>
|
|
:root {
|
|
--hg-violet: #7c3aed;
|
|
--hg-violet-2: #a855f7;
|
|
--hg-bg: #0a0a0f;
|
|
--hg-fg: #f5f5fa;
|
|
--hg-dim: #6b6b78;
|
|
}
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
.stage {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.hero {
|
|
font-weight: 900;
|
|
font-size: 320px;
|
|
letter-spacing: -0.05em;
|
|
color: var(--hg-fg);
|
|
white-space: nowrap;
|
|
will-change: transform, opacity;
|
|
position: relative;
|
|
z-index: 10;
|
|
}
|
|
.particle-stage {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
pointer-events: none;
|
|
}
|
|
.particle {
|
|
position: absolute;
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
background: var(--hg-violet-2);
|
|
box-shadow: 0 0 12px var(--hg-violet-2);
|
|
opacity: 0;
|
|
will-change: transform, opacity;
|
|
}
|
|
</style>
|
|
<div class="particle-stage" id="particles"></div>
|
|
<div class="stage"><div class="hero">SPARK</div></div>
|
|
<script>
|
|
window.__timelines = window.__timelines || {};
|
|
const tl = gsap.timeline({ paused: true });
|
|
|
|
// Build N particles deterministically
|
|
const N = 36;
|
|
const container = document.getElementById("particles");
|
|
const particles = [];
|
|
for (let i = 0; i < N; i++) {
|
|
const p = document.createElement("div");
|
|
p.className = "particle";
|
|
// Vary size per particle for visual interest
|
|
const sz = 4 + (i % 4) * 3;
|
|
p.style.width = sz + "px";
|
|
p.style.height = sz + "px";
|
|
// Slight color variation
|
|
const hue = ((i * 17) % 60) - 30;
|
|
p.style.filter = `hue-rotate(${hue}deg)`;
|
|
container.appendChild(p);
|
|
particles.push(p);
|
|
}
|
|
|
|
// Hero punch + flash entry
|
|
tl.fromTo(
|
|
".hero",
|
|
{ scale: 0.85, opacity: 0 },
|
|
{ scale: 1, opacity: 1, duration: 0.3, ease: "power4.out" },
|
|
0.3,
|
|
);
|
|
|
|
// Particles burst out
|
|
particles.forEach((p, i) => {
|
|
const angle = (i / N) * Math.PI * 2 + i * 0.137; // golden-angle jitter
|
|
const radius = 500 + (i % 5) * 90 + (i % 3) * 40;
|
|
const tx = Math.cos(angle) * radius;
|
|
const ty = Math.sin(angle) * radius;
|
|
const dur = 1.1 + (i % 5) * 0.08;
|
|
tl.fromTo(
|
|
p,
|
|
{ x: 0, y: 0, scale: 1, opacity: 1 },
|
|
{ x: tx, y: ty, scale: 0, opacity: 0, duration: dur, ease: "expo.out" },
|
|
0.35 + (i % 6) * 0.012,
|
|
);
|
|
});
|
|
|
|
// Hero settle wobble
|
|
tl.to(".hero", { scale: 1.04, duration: 0.1, ease: "power3.out" }, 0.35);
|
|
tl.to(".hero", { scale: 1.0, duration: 0.5, ease: "elastic.out(1, 0.5)" }, 0.45);
|
|
|
|
window.__timelines["particle-burst"] = tl;
|
|
</script>
|
|
</div>
|
|
</template>
|