pixi-reels

AnticipationCurve

pixi-reels


pixi-reels / index / AnticipationCurve

Type Alias: AnticipationCurve

type AnticipationCurve = 
  | AnticipationSegment[]
  | ((order: number, total: number) => AnticipationSegment[]);

Defined in: config/types.ts:211

The shape of a tease, as a list of speed legs played in order.

Pass a function to vary the curve per reel: order is the reel’s place in the anticipation set (0 for the first tease reel) and total is how many are teasing, so the last reel can crawl deeper or hold longer than the first without hand-writing every reel’s curve.

Examples#

// Surge, then crawl. The classic modern tease.
curve: [
  { speed: 1.8,  duration: 220, ease: 'power2.in' },
  { speed: 0.12, duration: 700, ease: 'power3.inOut', hold: 400 },
]
// Each successive reel crawls slower and holds longer.
curve: (order, total) => {
  const f = total > 1 ? order / (total - 1) : 0;
  return [{ speed: 0.4 - 0.3 * f, duration: 300, hold: 200 + 400 * f }];
}