pixi-reels
Building blocks

Speed modes

A speed profile is every number that decides how a spin feels. Acceleration, speed, stop stagger, bounce.

The three defaults#

import { SpeedPresets } from 'pixi-reels';

// SpeedPresets.NORMAL      . "relaxed" feel
// SpeedPresets.TURBO       . faster stop, short accel
// SpeedPresets.SUPER_TURBO . almost-instant

Call no .speed() at all and you get NORMAL under the name 'normal'.

Switch at runtime#

reelSet.speed.addProfile('turbo', SpeedPresets.TURBO);
reelSet.setSpeed('turbo');
reelSet.events.on('speed:changed', (p, prev) => console.log(p.name, prev.name));

Custom profile#

const CINEMATIC: SpeedProfile = {
  name: 'cinematic',
  spinDelay: 280,
  spinSpeed: 38,
  stopDelay: 180,
  anticipationDelay: 1200,
  bounceDistance: 14,
  bounceDuration: 260,
  accelerationEase: 'power3.in',
  decelerationEase: 'elastic.out(1, 0.5)',
  accelerationDuration: 420,
  minimumSpinTime: 1400,
};

builder
  .speed('cinematic', CINEMATIC)
  .initialSpeed('cinematic');