Petal wind

Sakura petals that tumble and flip as they fall. Move the pointer and the air moves with it, then settles.

Move the pointer through the petals.

Features

  • Notched sakura petals that tumble and flip; a petal lying flat to the air falls slower than one edge-on.
  • The pointer stirs a coarse field of air that decays over about half a second, so the petals along its path are pushed and keep drifting.
  • Petals are born where you say (the blossoms of a tree), and a trigger sends one gust across.
  • A 2D canvas with pre-drawn sprites: no GPU needed. It stops off-screen and in hidden tabs.

Use it for

  • A quiet, living header.
  • Seasonal pages, celebrations, a scene that answers the hand.

On this site

Installation

  1. Get runets.
    git clone https://github.com/ziyam-khan/runets
  2. Copy these files into your project, keeping their folders.
  3. Install what they use.
    pnpm add react
  4. Load the styles once. Bring your own base tokens, or use runets’ default theme.
    import 'runets/styles/theme.css'
    import 'runets/styles/kit.css'

Usage

import { PetalWind } from 'runets'

<header style={{ position: 'relative' }}>
  <PetalWind count={36} breeze={22} source={() => canopyBox()} trigger={slide} />
</header>

API

PropTypeWhat it does
countnumberPetals in the air at once (36).
colors(number | string)[]Tints as 0xRRGGBB or CSS colours; changing them repaints in place.
breezenumberSteady wind in px/s; positive blows left (22).
fallnumberEdge-on fall speed in px/s (46).
stirnumberHow hard the pointer pushes the air; 0 turns it off (1).
source() => Box | nullWhere a petal is born, in the layer’s pixels; the top edge by default.
triggernumberChange it to send one gust.
pausedbooleanHold the petals where they are.

Accessibility

Source

The code is in src/kit/petal-wind.tsx in runets, MIT licensed.