2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Effects

WeatherFx

Updated: October 25, 2025
View on GitHub
The WeatherFx component creates animated weather effects using the native Canvas 2D API. It supports rain, snow, falling leaves, and lightning with customizable colors, speed, and intensity. Perfect for backgrounds, hero sections, or thematic content areas. Switch between different weather effects: rain, snow, falling leaves, and lightning. Control the number of particles with the intensity prop. Higher values create denser effects. Control the fall speed with the speed prop. Higher values make particles fall faster. Control the direction with the angle prop to simulate wind. Positive values angle to the right, negative to the left. Use multiple colors for variety. Supports CSS variables and any valid color format. Overlay content on top of the weather effect. Use as a full-screen background effect with absolute positioning. Snow features realistic physics with depth-based sizing, opacity, and organic floating motion. Leaves feature gradient colors, rotation animation, and tumbling motion for an autumn feel. Lightning features highly realistic bolt generation with chaotic, organic branching at all angles. Each bolt creates dense networks of branches spreading in multiple directions with up to 4 levels of hierarchy. The effect uses small, erratic segments and high branching probability to create the natural, fractal-like appearance of real lightning. Bolts animate from top to bottom with progressively thinner branches. The intensity prop controls both the frequency and number of simultaneous strikes. For lightning, the intensity prop controls strike frequency and bolt patterns. The effect alternates between single and multi-bolt strikes for natural variation. Low intensity (1-15) creates single, rare strikes. Medium intensity (16-30) occasionally spawns double bolts. High intensity (31-60) alternates between single and 2-3 bolt strikes. Very high intensity (61+) creates dramatic storms alternating between single and 2-4 simultaneous bolts. Control how long particles are emitted with the duration prop (in seconds). After the duration, existing particles finish their animation but no new ones spawn. Use trigger="hover" to only emit particles when hovering over the element. Use trigger="click" to toggle emission on click. Use trigger="manual" with the active prop to control emission from parent state. WeatherFx automatically detects low-end devices and the prefers-reduced-motion system setting. When either is detected, the animation is completely disabled (no particles are rendered). You can override this with the reducedMotion prop. See useReducedMotion for details.
Prop
Type
Default
type
Which weather to render.
rainsnowleaveslightning
rain
speed
Fall multiplier. Not a duration.
number1
colors
Palette for the drops or flakes.
string[]["brand-solid-medium"]
intensity
How much of it there is.
number50
angle
Fall angle, in degrees.
number0
duration
Stop after this long, in milliseconds. Runs indefinitely if unset.
number
trigger
What starts it. "manual" hands control to active.
mounthoverclickmanual
mount
active
Run it, when trigger is "manual".
booleanfalse
reducedMotion
"auto" follows the reader's system setting, which is the right default for anything ambient.
booleanauto
auto
children
React.ReactNode
…and every FlexProps propinherited
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club