Particle System Simulation
Nature of Code Lesson #4.1
Welcome to Chapter 4 of The Nature of Code: Particle Systems! I begin by coding a simple particle system in p5.js. I convert the Mover class into a Particle class, add a lifetime property, and organize a collection of particles into an array.
Topics
- 0:00 - Welcome to chapter 4!
- 0:24 - Explain! What is a particle system?
- 1:24 - Explain! What do we have to code?
- 2:01 - Code! Let's make a particle class!
- 2:46 - Code! Adding a lifetime property.
- 3:41 - Code! Many particles!
- 5:16 - Code! Emitting particles.
- 5:51 - Code! Removing finished particles from the array.
- 7:59 - Code! Let's make a few tweaks to this system?
- 8:55 - What's next?
Community Contributions
- Secret Contributution by Indrayudh Chakraborty (Source Code)
- Opposite Particles System by Indrayudh Chakraborty (Source Code)
- Electric Sparks by Krishanth (Source Code)
- Recursive Explosions by LemurDaniel (Source Code)
- Burning torch by wojtekpaszo (Source Code)
- Boxy fire by wojtekpaszo (Source Code)
- Firecracker by Dong-Gkyun Yang (Source Code)
You can also add your own version! (See how)
Links discussed in this lesson
- Particle Systems - A Technique for Modeling a Class of Fuzzy Objects by William T. Reeves
Videos discussed in this lesson
- Simple Particle System - Coding Challenge #78 by The Coding Train
- Simulating Forces - Nature of Code 2.1 by The Coding Train
- Arrays of Objects - p5.js Tutorial 7.3 by The Coding Train
- Fireworks! - Coding Challenge #27 by The Coding Train
- Array Functions: filter() by The Coding Train
- Removing Objects from Arrays - p5.js Tutorial 7.5 by The Coding Train