Map Fire
terrae/fireFreeComponent
Realistic animated fire effect with particle simulation.
Install it
npx shadcn@latest add https://www.terrae.dev/fire.jsonSource
1"use client"23import { useEffect, useRef, useState, useCallback } from "react"4import { useMap } from "./hooks"5import type { MapCoordinates } from "./types"67type FireParticle = {8 x: number9 y: number10 velocityX: number11 velocityY: number12 radius: number13 life: number14 maxLife: number15}1617type FireSource = {18 x: number19 y: number20 particles: FireParticle[]21 spawnTime: number22 intensity: number23}2425type MapFireProps = {26 id: string27 coordinates: MapCoordinates28 size?: number29 intensity?: number30 particleCount?: number31 baseColor?: string32 tipColor?: string33 spread?: boolean34 spreadSpeed?: number35 spreadRadius?: number36 maxSpreadPoints?: number37 autoStart?: boolean38}3940type FireRenderer = {41 width: number42 height: number43 data: Uint8ClampedArray44 context?: CanvasRenderingContext2D45 sources: FireSource[]46 isActive: boolean47 startTime: number48 currentIntensity: number49 onAdd: () => void50 render: () => boolean51 start: () => void52 stop: () => void53 addSource: (x: number, y: number) => void54 setIntensity: (intensity: number) => void55}5657type FireControl = {58 start: () => void59 stop: () => void60 setIntensity: (intensity: number) => void61 isActive: boolean62 spreadProgress: number63}6465type RgbColor = {66 r: number67 g: number68 b: number69}7071const DEFAULT_SIZE = 12072const DEFAULT_INTENSITY = 173const DEFAULT_PARTICLE_COUNT = 5074const DEFAULT_BASE_COLOR = "#ffcc00"75const DEFAULT_TIP_COLOR = "#ff3300"76const DEFAULT_SPREAD_SPEED = 200077const DEFAULT_SPREAD_RADIUS = 0.478const DEFAULT_MAX_SPREAD_POINTS = 87980const INITIAL_Y_POSITION = 0.8581const SPREAD_SCALE = 1.582const MIN_PARTICLES_PER_SOURCE = 1583const VELOCITY_DECAY = 0.9884const FLICKER_BASE = 0.985const FLICKER_RANGE = 0.286const COLOR_GRADIENT_INNER = 0.387const ALPHA_MULTIPLIER = 0.888const INTENSITY_VARIATION_BASE = 0.789const INTENSITY_VARIATION_RANGE = 0.390const MIN_INTENSITY = 0.191const MAX_INTENSITY = 392const CANVAS_PADDING = 0.193const VERTICAL_VARIATION = 0.194const GLOW_SIZE_SPREAD = 0.0895const GLOW_SIZE_NORMAL = 0.1596const GLOW_OPACITY = 0.2597const PARTICLE_SPREAD_X = 2098const BASE_VELOCITY_Y = -1.599const VELOCITY_X_RANGE = 0.8100const VELOCITY_Y_RANGE = -1101const PARTICLE_Y_OFFSET = 10102const BASE_RADIUS = 4103const RADIUS_RANGE = 8104const BASE_LIFE = 40105const LIFE_RANGE = 40106const LIFE_RADIUS_DECAY = 0.5107const COLOR_FACTOR_MULTIPLIER = 1.5108const PIXEL_RATIO = 2109const CONTROL_UPDATE_INTERVAL = 100110111const fireControls = new Map<string, FireControl>()112113// … 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 |
