{
  "title": "Aurora Fireworks",
  "description": "Three sparkling particle bursts with a viewer name, drawn on a transparent canvas.",
  "headline": "Fireworks",
  "detail": "",
  "shareInCommunity": true,
  "version": 2,
  "program": "function render({ ctx, width, height, time, event }) {\n  const unit = Math.min(width, height);\n  const palette = [\"#a7ff66\", \"#55edff\", \"#fbb754\", \"#ff78d6\", \"#ae95ff\"];\n  const bursts = [\n    { x: .38, y: .46, at: .65, hue: 0 },\n    { x: .68, y: .32, at: 1.1, hue: 2 },\n    { x: .54, y: .61, at: 1.65, hue: 3 },\n  ];\n  const strength = Math.min(140, 72 + 6 * Math.max(0, Number(event.count) || 0));\n  const random = (index) => {\n    const value = Math.sin(index * 127.1 + 311.7) * 43758.5453123;\n    return value - Math.floor(value);\n  };\n  ctx.clearRect(0, 0, width, height);\n  ctx.save();\n  ctx.globalCompositeOperation = \"lighter\";\n\n  for (const [index, burst] of bursts.entries()) {\n    const age = time - burst.at;\n    const x = burst.x * width;\n    const y = burst.y * height;\n    if (age < 0 && age > -.55) {\n      const launch = 1 + age / .55;\n      const rocketY = height + (y - height) * launch;\n      ctx.strokeStyle = palette[burst.hue];\n      ctx.lineWidth = Math.max(1, unit * .007);\n      ctx.beginPath();\n      ctx.moveTo(x, rocketY);\n      ctx.lineTo(x - unit * .025, rocketY + unit * .1);\n      ctx.stroke();\n    }\n    if (age < 0 || age > 2.25) continue;\n\n    const spread = .45 * (1 - Math.exp(-age * 1.65)) * unit;\n    const fade = Math.max(0, 1 - age / 2.25);\n    const glow = ctx.createRadialGradient(x, y, 0, x, y, Math.max(1, unit * .21 + spread * .35));\n    glow.addColorStop(0, palette[burst.hue] + \"78\");\n    glow.addColorStop(1, palette[burst.hue] + \"00\");\n    ctx.globalAlpha = fade * fade;\n    ctx.fillStyle = glow;\n    ctx.fillRect(0, 0, width, height);\n\n    for (let i = 0; i < strength; i++) {\n      const seed = index * 173 + i;\n      const angle = i / strength * Math.PI * 2 + random(seed) * .27;\n      const velocity = .28 + .72 * random(seed + .5);\n      const radius = spread * velocity;\n      const gravity = age * age * unit * .043;\n      const px = x + Math.cos(angle) * radius;\n      const py = y + Math.sin(angle) * radius + gravity;\n      const trail = unit * (.009 + .021 * velocity) * fade;\n      const flicker = .52 + .48 * Math.sin(seed * 1.3 + time * (8 + velocity * 15)) ** 2;\n      const colour = palette[(burst.hue + (i % 15 === 0 ? 2 : i % 4 === 0 ? 1 : 0)) % palette.length];\n      ctx.globalAlpha = fade * flicker;\n      ctx.strokeStyle = colour;\n      ctx.lineWidth = Math.max(1, unit * (.003 + .007 * random(seed + 1)));\n      ctx.lineCap = \"round\";\n      ctx.beginPath();\n      ctx.moveTo(px - Math.cos(angle) * trail, py - Math.sin(angle) * trail);\n      ctx.lineTo(px, py);\n      ctx.stroke();\n\n      if (i % 11 === 0) {\n        ctx.fillStyle = \"#ffffff\";\n        ctx.beginPath();\n        ctx.arc(px, py, Math.max(1, unit * .005), 0, Math.PI * 2);\n        ctx.fill();\n      }\n    }\n  }\n\n  ctx.globalCompositeOperation = \"source-over\";\n  ctx.globalAlpha = Math.min(1, Math.max(0, (time - .48) * 3), Math.max(0, (4 - time) * 2));\n  ctx.textAlign = \"center\";\n  ctx.textBaseline = \"middle\";\n  ctx.font = \"700 \" + Math.max(14, unit * .11) + \"px system-ui\";\n  ctx.shadowColor = \"#180930\";\n  ctx.shadowBlur = unit * .05;\n  ctx.fillStyle = \"#fff\";\n  const name = (event.user || \"Fireworks\").slice(0, 28);\n  ctx.fillText(name, width / 2, height * .83, width * .88);\n  ctx.restore();\n}",
  "fps": 30,
  "mode": "alert",
  "durationSeconds": 4,
  "events": [
    "GIFT",
    "FOLLOW"
  ]
}
