Map Meteor
terrae/meteorFreeComponent
Animated meteor falling from sky with fiery trail and impact effect.
Install it
npx shadcn@latest add https://www.terrae.dev/meteor.jsonSource
1"use client"23import { useEffect, useRef, useState } from "react"4import { useMap } from "./hooks"5import type { MapCoordinates } from "./types"67type TrailParticle = {8 positionX: number9 positionY: number10 radius: number11 opacity: number12 velocityX: number13 velocityY: number14 life: number15 maxLife: number16}1718type ImpactParticle = {19 positionX: number20 positionY: number21 radius: number22 opacity: number23 velocityX: number24 velocityY: number25 color: string26}2728type MeteorInstance = {29 startX: number30 startY: number31 currentX: number32 currentY: number33 progress: number34 trailParticles: TrailParticle[]35 delay: number36 active: boolean37}3839type RgbColor = {40 red: number41 green: number42 blue: number43}4445type MeteorPhase = "falling" | "impact" | "fading" | "idle"4647type MeteorRenderer = {48 width: number49 height: number50 data: Uint8ClampedArray51 context?: CanvasRenderingContext2D52 meteors: MeteorInstance[]53 impactParticles: ImpactParticle[]54 isActive: boolean55 startTime: number56 progress: number57 phase: MeteorPhase58 flashOpacity: number59 restartTimerId: number60 onAdd: () => void61 render: () => boolean62 start: () => void63 stop: () => void64 reset: () => void65}6667type MeteorControl = {68 start: () => void69 stop: () => void70 reset: () => void71 isActive: boolean72 progress: number73 phase: MeteorPhase74}7576type MapMeteorProps = {77 id: string78 target: MapCoordinates79 size?: number80 angle?: number81 speed?: number82 intensity?: number83 meteorColor?: string84 trailColor?: string85 impactColor?: string86 tailLength?: number87 meteorSize?: number88 impactSize?: number89 autoStart?: boolean90 loop?: boolean91 loopDelay?: number92 shower?: boolean93 showerCount?: number94}9596const DEFAULT_SIZE = 30097const DEFAULT_ANGLE = 4598const DEFAULT_SPEED = 200099const DEFAULT_INTENSITY = 1100const DEFAULT_METEOR_COLOR = "#ffaa00"101const DEFAULT_TRAIL_COLOR = "#ff6600"102const DEFAULT_IMPACT_COLOR = "#ffdd00"103const DEFAULT_TAIL_LENGTH = 0.4104const DEFAULT_METEOR_SIZE = 8105const DEFAULT_IMPACT_SIZE = 0.3106const DEFAULT_LOOP_DELAY = 2000107const DEFAULT_SHOWER_COUNT = 4108109const DEGREES_TO_RADIANS = Math.PI / 180110const TRAIL_SPAWN_RATE = 3111const TRAIL_MIN_RADIUS = 2112const TRAIL_MAX_RADIUS = 6113const TRAIL_MIN_LIFE = 20114const TRAIL_MAX_LIFE = 40115const TRAIL_VELOCITY_SPREAD = 0.5116const TRAIL_POSITION_SPREAD = 4117const TRAIL_VELOCITY_DAMPING = 0.1118const TRAIL_BASE_OPACITY = 0.8119const TRAIL_OPACITY_VARIANCE = 0.2120const TRAIL_GRAVITY_MULTIPLIER = 0.3121// … 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 |
