This library is not production-ready yet. Developers should use it with caution and expect breaking changes.

Explosion

Animated explosion burst effect with radial particles and flash.

Installation

First, make sure you have the base map component installed:

npx shadcn@latest add https://www.terrae.dev/map.json

Then install the explosion component:

npx shadcn@latest add https://www.terrae.dev/explosion.json

Nuclear Type

Set type="nuclear" for a dramatic mushroom cloud explosion. Features a rising fireball, expanding mushroom cap, shockwave ring, and longer-lasting particles. Automatically increases size and duration for maximum impact.

Custom Colors

Customize the explosion colors with coreColor (center flash) and outerColor (particle trails). Create fiery, electric, or magical explosion effects.

Multiple Explosions

Compose multiple MapExplosion instances in the same area with staggered timing to simulate a barrage. Each explosion runs independently with its own size, duration, and loop delay.

Programmatic Control

Use useExplosionControl hook to trigger explosions programmatically. Set autoStart=false to prevent the explosion from firing on mount, then call control.trigger() when needed.

Properties

PropertyTypeDefaultDescription
idstringrequiredUnique identifier for the explosion
coordinates[number, number]requiredExplosion location as [longitude, latitude]
type"burst" | "nuclear""burst"Explosion style - burst (radial) or nuclear (mushroom cloud)
sizenumber150Explosion size in pixels (nuclear min: 200)
particleCountnumber60Number of explosion particles (nuclear min: 80)
durationnumber3000Total visible time from appear to fade (nuclear min: 4000)
coreColorstring#ffffffCenter flash color
outerColorstring#ff6600Particle trail color
autoStartbooleantrueTrigger explosion on mount
loopbooleanfalseRepeat explosion continuously
loopDelaynumber3000Delay between loops in milliseconds

Use Cases

Gaming Maps

Impact effects for strategy and battle games

Event Triggers

Visual feedback for user interactions or achievements