Installation
npx kinetic-ui-cli@latest add slot-machine-reelMechanics
Each character in the target string is rendered as its own isolated <SingleReel /> component.
- When initialized, the component generates an array of 30 randomized characters, inserting the true
targetCharat the very end of the array. - During the
spinning=truephase, Framer Motion loops a very fast linear Y-translation to create mechanical motion blur. - When
spinning=false, it interrupts the loop and triggers a spring physics animation targetingy: -(length - 1) * 100%, which perfectly aligns the final target character in the viewport clip window. - An inset CSS shadow simulates the curved depth of a physical casino barrel.
Usage Guide
1. Import the Component
Import the component into your React or Next.js page:
import { SlotMachineReel } from "@/components/creative/slot-machine-reel";
2. Implementation Example
Render the component and customize its behavior by passing props:
import { SlotMachineReel } from "@/components/creative/slot-machine-reel";
export default function Example() {
return (
<div className="w-full flex items-center justify-center p-8">
<SlotMachineReel
value="example"
spinning{true}
/>
</div>
);
}