Hero Templates

Sky Lanterns

A night lake with hundreds of paper lanterns rising off it, beside left-aligned copy. Each lantern is lit from inside, wavers like a flame and has a soft glow, and the water under it holds a broken reflection. Sweep the pointer through a lantern to knock it away. A hit through the middle sends it straight, a graze sends it sideways and spinning, and it swings, slows in the air and can bump the next one. Click the water to let go of a new cluster. Drag to turn the camera around the lake.

Install

bun add ogl

Then copy 2 files into your project:

  • components/registry/sky-lanterns/sky-lanterns.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
count"150" | "300" | "600""300"How many lanterns are in the air, in fixed steps. Each step rebuilds them.
lanternColorstring (hex)"#ff8a3c"The paper of the lanterns.
glowColorstring (hex)"#ffd9a0"The flame, and the light it throws.
skyColorstring (hex)"#070a1c"The sky overhead. The horizon is worked out from it.
waterColorstring (hex)"#080d20"The lake.
risenumber1How fast the lanterns climb. 0 holds them in the air.
flickernumber0.5How much each flame wavers.
windnumber0.6How far the wind leans the lanterns as they climb.
hazenumber0.4Mist in the air. More mist gives each lantern a bigger glow and hides the far ones.
reflectionnumber0.6How strong the reflections on the water are.
autoRotatebooleantrueThe camera turns slowly while nothing is held.
parallaxbooleantrueThe camera leans toward the pointer, easing back on leave.

What It Demonstrates

Loop
An animation that repeats, a set number of times or infinitely.
Float
A gentle, continuous up-and-down drift that makes a static element feel alive and weightless.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Drag
Moving an element by grabbing it, often with momentum when released.
Momentum
Motion that carries velocity, especially after a drag or interruption.
Velocity
How fast and in which direction an element is moving. A spring carries it into the next animation when interrupted, so a flicked element keeps its speed.
Follow-through
Parts of an element keep moving and settle slightly after the main motion stops, adding weight.
Hover effect
Visual change when the cursor moves over an element.
Hardware acceleration
Animating transform and opacity lets the GPU keep motion smooth.

Related Components

Appears In