BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/terrae/explosion

Map Explosion

terrae/explosion
FreeComponent

Animated explosion burst effect with radial particles and flash.

Install it

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

Source

src/registry/map/explosion.tsxwww.terrae.dev/explosion.json · first 6 KB
1"use client"
2
3import { useEffect, useRef, useState } from "react"
4import { useMap } from "./hooks"
5import type { MapCoordinates } from "./types"
6
7type RgbColor = {
8 r: number
9 g: number
10 b: number
11}
12
13type ExplosionType = "burst" | "nuclear"
14
15type ExplosionParticle = {
16 x: number
17 y: number
18 velocityX: number
19 velocityY: number
20 radius: number
21 life: number
22 maxLife: number
23 color: RgbColor
24 type: "debris" | "fireball" | "mushroom" | "shockwave"
25}
26
27type MapExplosionProps = {
28 id: string
29 coordinates: MapCoordinates
30 type?: ExplosionType
31 size?: number
32 particleCount?: number
33 duration?: number
34 coreColor?: string
35 outerColor?: string
36 autoStart?: boolean
37 loop?: boolean
38 loopDelay?: number
39}
40
41type ExplosionRenderer = {
42 width: number
43 height: number
44 data: Uint8ClampedArray
45 context?: CanvasRenderingContext2D
46 particles: ExplosionParticle[]
47 isExploding: boolean
48 explosionTime: number
49 shockwaveRadius: number
50 onAdd: () => void
51 render: () => boolean
52 trigger: () => void
53 reset: () => void
54}
55
56type ExplosionControl = {
57 trigger: () => void
58 reset: () => void
59 isExploding: boolean
60}
61
62const DEFAULT_SIZE = 150
63const DEFAULT_PARTICLE_COUNT = 60
64const DEFAULT_DURATION = 3000
65const DEFAULT_CORE_COLOR = "#ffffff"
66const DEFAULT_OUTER_COLOR = "#ff6600"
67const DEFAULT_LOOP_DELAY = 3000
68const FRAME_RATE = 60
69
70const BURST_SPEED_MIN = 1.5
71const BURST_SPEED_RANGE = 4
72const BURST_CORE_PROBABILITY = 0.3
73const BURST_LIFE_VARIATION_MIN = 0.7
74const BURST_LIFE_VARIATION_RANGE = 0.3
75const BURST_CORE_RADIUS_MIN = 4
76const BURST_CORE_RADIUS_RANGE = 6
77const BURST_OUTER_RADIUS_MIN = 3
78const BURST_OUTER_RADIUS_RANGE = 8
79
80const NUCLEAR_LIFE_VARIATION_MIN = 0.6
81const NUCLEAR_LIFE_VARIATION_RANGE = 0.4
82const NUCLEAR_FIREBALL_DISTANCE_RATIO = 0.1
83const NUCLEAR_FIREBALL_VELOCITY_SPREAD = 0.5
84const NUCLEAR_FIREBALL_VELOCITY_MIN = -0.8
85const NUCLEAR_FIREBALL_VELOCITY_RANGE = -1.2
86const NUCLEAR_FIREBALL_RADIUS_MIN = 8
87const NUCLEAR_FIREBALL_RADIUS_RANGE = 12
88const NUCLEAR_FIREBALL_LIFE_FACTOR = 0.9
89const NUCLEAR_MUSHROOM_SPREAD_RATIO = 0.15
90const NUCLEAR_MUSHROOM_Y_OFFSET_RATIO = 0.25
91const NUCLEAR_MUSHROOM_VELOCITY_MIN = 0.5
92const NUCLEAR_MUSHROOM_VELOCITY_RANGE = 1
93const NUCLEAR_MUSHROOM_VERTICAL_MIN = -0.3
94const NUCLEAR_MUSHROOM_VERTICAL_RANGE = -0.5
95const NUCLEAR_MUSHROOM_RADIUS_MIN = 10
96const NUCLEAR_MUSHROOM_RADIUS_RANGE = 15
97const NUCLEAR_DEBRIS_SPEED_MIN = 2
98const NUCLEAR_DEBRIS_SPEED_RANGE = 3
99const NUCLEAR_DEBRIS_VERTICAL_FACTOR = 0.6
100// … truncated

What it pulls in

npm packages

  • mapbox-gl

Other registry items

  • https://www.terrae.dev/map.json

Files it writes

  • src/registry/map/explosion.tsx

Facts

Registry
terrae
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

www.terrae.dev alamenai/terrae on GitHub Raw registry item This item as JSON

More from terrae

All 40 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Map Animated Circleanimated-circleterraeComponentsFree1 dep
Map Animated Footprintanimated-footprintterraeComponentsFree2 deps
Map Animated Polygonanimated-polygonterraeComponentsFree1 dep
Map Animated Pulseanimated-pulseterraeComponentsFree1 dep
Map Arc Animatedarc-animatedterraeComponentsFree1 dep
Map Blur Areablur-areaterraeComponentsFree1 dep
Map Camera Followcamera-followterraeComponentsFree1 dep
Map ChoroplethchoroplethterraeComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex