Snow Settle
Snow that falls and accumulates, building an uneven drift along the bottom edge.
The canvas in this preview is the file shown here. The surrounding demo shell only provides context and is not part of the copied code.
import { useEffect, useRef } from "react";
/**
* Vibary · Snow Settle
*
* Snow that falls and then stays: the bottom edge is a heightmap of
* columns, and every flake that lands writes into the column it hit
* plus a little into its neighbours. Two things follow from that andAbout this effect
Most snow effects are rain with white dots; this one has somewhere to land. The bottom edge is a heightmap of narrow columns, and every flake that reaches it writes into the column it hit plus a share into each neighbour. The drift comes out uneven for free — the same shared wind that sways the flakes decides which columns they reach — and because each column also creeps toward the average of its neighbours, a spike slumps into a bank rather than standing up like a bar chart. Once it holds its volume the drift compacts instead of growing, so fresh snow keeps roughening a bank that has stopped rising — capping each column instead would fill them all to the ceiling and the slump would iron the drift flat. It survives a resize by resampling the profile, and settles at a mean depth well under a fifth of the container.