Map Cyclone
terrae/cycloneFreeComponent
Animated cyclone funnel with swirling particles and debris.
Install it
npx shadcn@latest add https://www.terrae.dev/cyclone.jsonSource
1"use client"23import { useEffect, useRef, useState } from "react"4import { useMap } from "./hooks"5import type { MapCoordinates, MapPath } from "./types"67type RgbColor = {8 r: number9 g: number10 b: number11}1213type CycloneParticle = {14 angle: number15 radius: number16 height: number17 angularVelocity: number18 verticalVelocity: number19 size: number20 opacity: number21 type: "funnel" | "debris" | "dust"22}2324type MapCycloneProps = {25 id: string26 coordinates: MapCoordinates27 path?: MapPath28 duration?: number29 loop?: boolean30 size?: number31 intensity?: number32 scale?: number33 particleCount?: number34 funnelColor?: string35 debrisColor?: string36 rotationSpeed?: number37 autoStart?: boolean38}3940type CycloneRenderer = {41 width: number42 height: number43 data: Uint8ClampedArray44 context?: CanvasRenderingContext2D45 particles: CycloneParticle[]46 isActive: boolean47 startTime: number48 currentIntensity: number49 targetIntensity: number50 currentScale: number51 targetScale: number52 rotationSpeed: number53 onAdd: () => void54 render: () => boolean55 start: () => void56 stop: () => void57 setIntensity: (intensity: number) => void58 setScale: (scale: number, instant?: boolean) => void59 setRotationSpeed: (speed: number) => void60}6162type CycloneControl = {63 start: () => void64 stop: () => void65 setIntensity: (intensity: number) => void66 setScale: (scale: number, instant?: boolean) => void67 setRotationSpeed: (speed: number) => void68 isActive: boolean69 isMoving: boolean70 progress: number71 scale: number72 rotationSpeed: number73}7475const DEFAULT_SIZE = 20076const DEFAULT_INTENSITY = 177const DEFAULT_SCALE = 178const DEFAULT_PARTICLE_COUNT = 12079const DEFAULT_FUNNEL_COLOR = "#8b9dc3"80const DEFAULT_DEBRIS_COLOR = "#5c4033"81const DEFAULT_ROTATION_SPEED = 182const DEFAULT_DURATION = 100008384const FUNNEL_BASE_RADIUS_RATIO = 0.0585const FUNNEL_TOP_RADIUS_RATIO = 0.2586const FUNNEL_RADIUS_VARIATION_MIN = 0.887const FUNNEL_RADIUS_VARIATION_RANGE = 0.488const FUNNEL_ANGULAR_VELOCITY_BASE = 0.0889const FUNNEL_ANGULAR_VELOCITY_RANGE = 0.0490const FUNNEL_VERTICAL_VELOCITY_BASE = 0.00391const FUNNEL_VERTICAL_VELOCITY_RANGE = 0.00292const FUNNEL_SIZE_BASE = 293const FUNNEL_SIZE_RANGE = 394const FUNNEL_OPACITY_BASE = 0.495const FUNNEL_OPACITY_RANGE = 0.49697const DEBRIS_HEIGHT_MAX = 0.798const DEBRIS_BASE_RADIUS_RATIO = 0.0899const DEBRIS_TOP_RADIUS_RATIO = 0.2100const DEBRIS_RADIUS_VARIATION_MIN = 1.2101const DEBRIS_RADIUS_VARIATION_RANGE = 0.8102const DEBRIS_ANGULAR_VELOCITY_BASE = 0.06103// … 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 |
