Map Explosion
terrae/explosionFreeComponent
Animated explosion burst effect with radial particles and flash.
Install it
npx shadcn@latest add https://www.terrae.dev/explosion.jsonSource
1"use client"23import { useEffect, useRef, useState } from "react"4import { useMap } from "./hooks"5import type { MapCoordinates } from "./types"67type RgbColor = {8 r: number9 g: number10 b: number11}1213type ExplosionType = "burst" | "nuclear"1415type ExplosionParticle = {16 x: number17 y: number18 velocityX: number19 velocityY: number20 radius: number21 life: number22 maxLife: number23 color: RgbColor24 type: "debris" | "fireball" | "mushroom" | "shockwave"25}2627type MapExplosionProps = {28 id: string29 coordinates: MapCoordinates30 type?: ExplosionType31 size?: number32 particleCount?: number33 duration?: number34 coreColor?: string35 outerColor?: string36 autoStart?: boolean37 loop?: boolean38 loopDelay?: number39}4041type ExplosionRenderer = {42 width: number43 height: number44 data: Uint8ClampedArray45 context?: CanvasRenderingContext2D46 particles: ExplosionParticle[]47 isExploding: boolean48 explosionTime: number49 shockwaveRadius: number50 onAdd: () => void51 render: () => boolean52 trigger: () => void53 reset: () => void54}5556type ExplosionControl = {57 trigger: () => void58 reset: () => void59 isExploding: boolean60}6162const DEFAULT_SIZE = 15063const DEFAULT_PARTICLE_COUNT = 6064const DEFAULT_DURATION = 300065const DEFAULT_CORE_COLOR = "#ffffff"66const DEFAULT_OUTER_COLOR = "#ff6600"67const DEFAULT_LOOP_DELAY = 300068const FRAME_RATE = 606970const BURST_SPEED_MIN = 1.571const BURST_SPEED_RANGE = 472const BURST_CORE_PROBABILITY = 0.373const BURST_LIFE_VARIATION_MIN = 0.774const BURST_LIFE_VARIATION_RANGE = 0.375const BURST_CORE_RADIUS_MIN = 476const BURST_CORE_RADIUS_RANGE = 677const BURST_OUTER_RADIUS_MIN = 378const BURST_OUTER_RADIUS_RANGE = 87980const NUCLEAR_LIFE_VARIATION_MIN = 0.681const NUCLEAR_LIFE_VARIATION_RANGE = 0.482const NUCLEAR_FIREBALL_DISTANCE_RATIO = 0.183const NUCLEAR_FIREBALL_VELOCITY_SPREAD = 0.584const NUCLEAR_FIREBALL_VELOCITY_MIN = -0.885const NUCLEAR_FIREBALL_VELOCITY_RANGE = -1.286const NUCLEAR_FIREBALL_RADIUS_MIN = 887const NUCLEAR_FIREBALL_RADIUS_RANGE = 1288const NUCLEAR_FIREBALL_LIFE_FACTOR = 0.989const NUCLEAR_MUSHROOM_SPREAD_RATIO = 0.1590const NUCLEAR_MUSHROOM_Y_OFFSET_RATIO = 0.2591const NUCLEAR_MUSHROOM_VELOCITY_MIN = 0.592const NUCLEAR_MUSHROOM_VELOCITY_RANGE = 193const NUCLEAR_MUSHROOM_VERTICAL_MIN = -0.394const NUCLEAR_MUSHROOM_VERTICAL_RANGE = -0.595const NUCLEAR_MUSHROOM_RADIUS_MIN = 1096const NUCLEAR_MUSHROOM_RADIUS_RANGE = 1597const NUCLEAR_DEBRIS_SPEED_MIN = 298const NUCLEAR_DEBRIS_SPEED_RANGE = 399const NUCLEAR_DEBRIS_VERTICAL_FACTOR = 0.6100// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from terrae
All 40 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Map Animated Circleanimated-circle | terrae | Components | Free | 1 dep | |
| Map Animated Footprintanimated-footprint | terrae | Components | Free | 2 deps | |
| Map Animated Polygonanimated-polygon | terrae | Components | Free | 1 dep | |
| Map Animated Pulseanimated-pulse | terrae | Components | Free | 1 dep | |
| Map Arc Animatedarc-animated | terrae | Components | Free | 1 dep | |
| Map Blur Areablur-area | terrae | Components | Free | 1 dep | |
| Map Camera Followcamera-follow | terrae | Components | Free | 1 dep | |
| Map Choroplethchoropleth | terrae | Components | Free | 1 dep |
