This example demonstrates the use of a particle system to simulate the motion of falling snowflakes. This program defines a snowflake class and uses an array to hold the snowflake objects.
Snowflakes: Created by Aatish Bhatia. Revised by Darren Kessner. From 2024 onwards, edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.
You can find the code history of these examples here: pre-2023 example, 2023 code. You can suggest improvements by contributing to the current website!
Related Examples

Snowflakes falling on a black background.
Snowflakes
Animate snowfall.

Twenty white circles on a black background.
Shake Ball Bounce
Animate ball movement based on mobile device motion.

A pattern of multicolored circles connected by white lines, on a black background.
Connected Particles
Draw circles and connecting lines using the mouse.

A group of bird-like objects, represented by rainbow triangles, modeling flocking behavior.
Flocking
Simulate bird flocking behavior.