Skip to Content
🎉Introducing Pumki UI
AnimationsBall Pit

Ballpit

Interactive balls with custom colors and physics

Pumki UIPumki UI

Ballpit Demo

Interactive balls with custom colors and physics

Installation

Usage


import Ballpit from '@/components/pumki-ui/animations/ballpit.tsx';

1<Ballpit />

Props

PropTypeDefaultDescription
classNamestring""Custom CSS classes for the canvas element.
followCursorbooleantrueIf true, the largest ball follows the mouse or touch position.
countnumber200Number of balls in the simulation.
colorsnumber[][0, 0, 0]Array of colors for the balls (as numbers).
ambientColornumber0xffffffAmbient light color.
ambientIntensitynumber1Ambient light intensity.
lightIntensitynumber200Point light intensity.
minSizenumber0.5Minimum ball size.
maxSizenumber1Maximum ball size.
size0number1Size of the largest ball (the one that follows the cursor).
gravitynumber0.5Gravity strength.
frictionnumber0.9975Friction factor for ball movement.
wallBouncenumber0.95Bounciness when balls hit the wall.
maxVelocitynumber0.15Maximum velocity for balls.
maxXnumber5Horizontal boundary for ball movement.
maxYnumber5Vertical boundary for ball movement.
maxZnumber2Depth boundary for ball movement.
Last updated on