AnimationsNew

Screensaver

An element flies around a box and bounces off the walls, like the old DVD logo.

Customize

color
accentColor
highlightColor

Based on Screensaver (MIT license) · Terms of use

More in Pro

View all

Props

9 properties
PropertyTypeDefaultDescription
speednumber3Speed, in pixels per frame.
startAnglenumber45Starting direction, in degrees.
startPosition{ x: number; y: number }"{ x: 0, y: 0 }"Start point as a percent of the container.
containerRefRefObject<HTMLElement | null>—Ref to the box whose walls the element bounces off.
childrenReactNode—What flies around: a logo, an image, a badge.
colorstring"#ffffff"Main colour. Children read it as var(--screensaver-c1).
accentColorstring"#a3a3a3"Second colour. Children read it as var(--screensaver-c2).
highlightColorstring"#ffffff"Light highlight colour. Children read it as var(--screensaver-c3).
classNamestring—Classes for the flying element.

Dependencies

3 required packages

npm install motion clsx tailwind-merge

Related components

View all