Kinetic UI
Back to Introduction
Physics & Micro-Interactions

Slot Machine Reel

Mechanical tumbling reels that spin and decelerate on random numbers, coupon reveals, or stats.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add slot-machine-reel
Slot Machine Reel

Installation

npx kinetic-ui-cli@latest add slot-machine-reel

Mechanics

Each character in the target string is rendered as its own isolated <SingleReel /> component.

  1. When initialized, the component generates an array of 30 randomized characters, inserting the true targetChar at the very end of the array.
  2. During the spinning=true phase, Framer Motion loops a very fast linear Y-translation to create mechanical motion blur.
  3. When spinning=false, it interrupts the loop and triggers a spring physics animation targeting y: -(length - 1) * 100%, which perfectly aligns the final target character in the viewport clip window.
  4. 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>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.