A gymnast's ribbon that trails the cursor
| Name | Type | Default | Description |
|---|---|---|---|
colors | [string, string] | ["#5227FF", "#FF9FFC"] | Front and back of the ribbon. The ribbon turns over wherever it folds, so both faces show as it flows, blending into each other slightly along its length. |
backgroundColor | string | "transparent" | Background of the component. Leave it transparent to lay the ribbon over your own page. |
width | number | 28 | Ribbon width in pixels. |
trail | number | 1.9 | Seconds the end of the ribbon lags behind the cursor. Longer trails stream further and take longer to coil back in when the cursor stops. |
bounce | number | 0.4 | How springy the ribbon is. Low values glide and settle, high values whip and curl past the cursor when it stops. |
angle | number | -35 | Angle the ribbon is held at, in degrees, like a calligraphy nib. The ribbon narrows and turns over wherever it travels along this angle. |
twist | number | 0 | Extra turn from the head to the tail, in degrees. It spirals the ribbon so it folds in more places. |
spin | number | 0 | Slowly rotates the holding angle, in degrees per second, so the folds keep moving. |
taper | number | 0.55 | How much the ribbon narrows towards its tail. It always opens out of a fine point at the cursor. |
shade | number | 0.6 | Dims the ribbon where it turns edge-on, which gives the folds their depth. 0 keeps both faces flat. |
opacity | number | 1 | Overall opacity of the ribbon. |
follow | number | 0.04 | Seconds the head of the ribbon takes to catch up with the pointer. |
flick | boolean | true | Clicking twirls the head of the ribbon in a small loop, throwing a curl down its length. The direction alternates with each click. |
autoplay | boolean | true | Until the pointer arrives, and again after it leaves, an invisible hand keeps the ribbon flowing. |
autoplaySpeed | number | 1 | Speed of that invisible hand. |
idleDelay | number | 1.5 | Seconds after the pointer leaves before the invisible hand takes the ribbon back. |
interactive | boolean | true | Let the pointer and touch lead the ribbon. The component listens on the window, so content laid over it still pulls the ribbon. |
paused | boolean | false | Freezes the ribbon. Reduced-motion users never get the invisible hand. |
dpr | number | 2 | Maximum device pixel ratio for the canvas. |
ref | { flick, reset } | — | Imperative controls: twirl the ribbon, or gather it back into the cursor. |
children | ReactNode | — | Content rendered above the ribbon, such as a hero. |
className | string | — | Classes for the root element. It fills its parent, with a 320px minimum height. |
style | CSSProperties | — | Inline styles for the root element. |
colors[string, string]Front and back of the ribbon. The ribbon turns over wherever it folds, so both faces show as it flows, blending into each other slightly along its length.
["#5227FF", "#FF9FFC"]backgroundColorstringBackground of the component. Leave it transparent to lay the ribbon over your own page.
"transparent"widthnumberRibbon width in pixels.
28trailnumberSeconds the end of the ribbon lags behind the cursor. Longer trails stream further and take longer to coil back in when the cursor stops.
1.9bouncenumberHow springy the ribbon is. Low values glide and settle, high values whip and curl past the cursor when it stops.
0.4anglenumberAngle the ribbon is held at, in degrees, like a calligraphy nib. The ribbon narrows and turns over wherever it travels along this angle.
-35twistnumberExtra turn from the head to the tail, in degrees. It spirals the ribbon so it folds in more places.
0spinnumberSlowly rotates the holding angle, in degrees per second, so the folds keep moving.
0tapernumberHow much the ribbon narrows towards its tail. It always opens out of a fine point at the cursor.
0.55shadenumberDims the ribbon where it turns edge-on, which gives the folds their depth. 0 keeps both faces flat.
0.6opacitynumberOverall opacity of the ribbon.
1follownumberSeconds the head of the ribbon takes to catch up with the pointer.
0.04flickbooleanClicking twirls the head of the ribbon in a small loop, throwing a curl down its length. The direction alternates with each click.
trueautoplaybooleanUntil the pointer arrives, and again after it leaves, an invisible hand keeps the ribbon flowing.
trueautoplaySpeednumberSpeed of that invisible hand.
1idleDelaynumberSeconds after the pointer leaves before the invisible hand takes the ribbon back.
1.5interactivebooleanLet the pointer and touch lead the ribbon. The component listens on the window, so content laid over it still pulls the ribbon.
truepausedbooleanFreezes the ribbon. Reduced-motion users never get the invisible hand.
falsedprnumberMaximum device pixel ratio for the canvas.
2ref{ flick, reset }Imperative controls: twirl the ribbon, or gather it back into the cursor.
—childrenReactNodeContent rendered above the ribbon, such as a hero.
—classNamestringClasses for the root element. It fills its parent, with a 320px minimum height.
—styleCSSPropertiesInline styles for the root element.
—