Skip to content

The open alternative to Salesforce, designed for AI.

5.5 KB
Raw Blame
import { FAST_PATH_SCENE } from '@/tokens/feature-scenes/fast-path-scene';

// The confetti burst's particle field, extracted verbatim from the old
// fast-path data; the dense set doubles the base with deterministic
// per-index offsets.
export type ConfettiParticle = {
  color: string;
  delay: number;
  height: number;
  left: number;
  radius: number;
  rotation: number;
  top: number;
  tx: number;
  ty: number;
  width: number;
};

const CONFETTI_COLORS = FAST_PATH_SCENE.confettiColors;

const CONFETTI_PARTICLES: ReadonlyArray<ConfettiParticle> = [
  {
    color: CONFETTI_COLORS.white,
    delay: 0,
    height: 14,
    left: 55,
    radius: 2,
    rotation: -154,
    top: 25,
    tx: -104,
    ty: -70,
    width: 8,
  },
  {
    color: CONFETTI_COLORS.pearl,
    delay: 26,
    height: 10,
    left: 58,
    radius: 999,
    rotation: 168,
    top: 29,
    tx: -126,
    ty: -12,
    width: 10,
  },
  {
    color: CONFETTI_COLORS.silver,
    delay: 40,
    height: 12,
    left: 60,
    radius: 2,
    rotation: 224,
    top: 34,
    tx: -96,
    ty: 42,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.softWhite,
    delay: 58,
    height: 14,
    left: 62,
    radius: 3,
    rotation: -220,
    top: 36,
    tx: -62,
    ty: 86,
    width: 9,
  },
  {
    color: CONFETTI_COLORS.mist,
    delay: 70,
    height: 8,
    left: 57,
    radius: 999,
    rotation: 144,
    top: 24,
    tx: -28,
    ty: -92,
    width: 8,
  },
  {
    color: CONFETTI_COLORS.smoke,
    delay: 88,
    height: 15,
    left: 54,
    radius: 2,
    rotation: 206,
    top: 31,
    tx: -136,
    ty: 18,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.white,
    delay: 108,
    height: 12,
    left: 64,
    radius: 2,
    rotation: -192,
    top: 28,
    tx: -18,
    ty: -56,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.pearl,
    delay: 124,
    height: 10,
    left: 59,
    radius: 999,
    rotation: 182,
    top: 39,
    tx: -90,
    ty: 104,
    width: 10,
  },
  {
    color: CONFETTI_COLORS.silver,
    delay: 148,
    height: 16,
    left: 52,
    radius: 2,
    rotation: -246,
    top: 27,
    tx: -150,
    ty: -28,
    width: 8,
  },
  {
    color: CONFETTI_COLORS.softWhite,
    delay: 166,
    height: 12,
    left: 66,
    radius: 2,
    rotation: 198,
    top: 33,
    tx: -36,
    ty: 62,
    width: 6,
  },
  {
    color: CONFETTI_COLORS.mist,
    delay: 184,
    height: 8,
    left: 56,
    radius: 999,
    rotation: -164,
    top: 35,
    tx: -118,
    ty: 74,
    width: 8,
  },
  {
    color: CONFETTI_COLORS.smoke,
    delay: 206,
    height: 14,
    left: 61,
    radius: 2,
    rotation: 236,
    top: 22,
    tx: -68,
    ty: -102,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.white,
    delay: 18,
    height: 9,
    left: 53,
    radius: 999,
    rotation: -126,
    top: 21,
    tx: -82,
    ty: -88,
    width: 9,
  },
  {
    color: CONFETTI_COLORS.pearl,
    delay: 52,
    height: 13,
    left: 50,
    radius: 2,
    rotation: 188,
    top: 30,
    tx: -126,
    ty: -18,
    width: 6,
  },
  {
    color: CONFETTI_COLORS.silver,
    delay: 76,
    height: 15,
    left: 63,
    radius: 2,
    rotation: -204,
    top: 23,
    tx: -56,
    ty: -76,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.softWhite,
    delay: 94,
    height: 8,
    left: 48,
    radius: 999,
    rotation: 164,
    top: 37,
    tx: -112,
    ty: 58,
    width: 8,
  },
  {
    color: CONFETTI_COLORS.mist,
    delay: 116,
    height: 12,
    left: 67,
    radius: 3,
    rotation: 214,
    top: 27,
    tx: -18,
    ty: -42,
    width: 8,
  },
  {
    color: CONFETTI_COLORS.smoke,
    delay: 136,
    height: 14,
    left: 51,
    radius: 2,
    rotation: -182,
    top: 34,
    tx: -138,
    ty: 36,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.white,
    delay: 156,
    height: 10,
    left: 58,
    radius: 999,
    rotation: 172,
    top: 19,
    tx: -74,
    ty: -104,
    width: 10,
  },
  {
    color: CONFETTI_COLORS.pearl,
    delay: 176,
    height: 13,
    left: 46,
    radius: 2,
    rotation: -236,
    top: 28,
    tx: -154,
    ty: 6,
    width: 6,
  },
  {
    color: CONFETTI_COLORS.silver,
    delay: 196,
    height: 8,
    left: 69,
    radius: 999,
    rotation: 146,
    top: 31,
    tx: -8,
    ty: 52,
    width: 8,
  },
  {
    color: CONFETTI_COLORS.softWhite,
    delay: 216,
    height: 15,
    left: 57,
    radius: 2,
    rotation: 242,
    top: 40,
    tx: -96,
    ty: 118,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.mist,
    delay: 238,
    height: 11,
    left: 61,
    radius: 3,
    rotation: -168,
    top: 26,
    tx: -46,
    ty: -66,
    width: 7,
  },
  {
    color: CONFETTI_COLORS.smoke,
    delay: 258,
    height: 13,
    left: 49,
    radius: 2,
    rotation: 206,
    top: 24,
    tx: -136,
    ty: -54,
    width: 6,
  },
];

export const DENSE_CONFETTI_PARTICLES: ReadonlyArray<ConfettiParticle> = [
  ...CONFETTI_PARTICLES,
  ...CONFETTI_PARTICLES.map((particle, index) => ({
    color: particle.color,
    delay: particle.delay + 12 + (index % 4) * 6,
    height: Math.max(7, particle.height - (index % 3 === 0 ? 1 : 0)),
    left: Math.max(
      44,
      Math.min(72, particle.left + (index % 2 === 0 ? -3 : 3)),
    ),
    radius: index % 5 === 0 ? 999 : particle.radius,
    rotation: particle.rotation + (index % 2 === 0 ? 22 : -26),
    top: Math.max(18, Math.min(42, particle.top + (index % 3 === 0 ? -2 : 2))),
    tx: particle.tx + (index % 2 === 0 ? -18 : 18),
    ty: particle.ty + (index % 3 === 0 ? -14 : 14),
    width: Math.max(6, particle.width - (index % 4 === 0 ? 1 : 0)),
  })),
];