Coding Challenge 180: Falling Sand

The Coding Train
The Coding Train
814.8 هزار بار بازدید - 6 ماه پیش - It's Genuary 2024! Watch as
It's Genuary 2024! Watch as I attempt to build a falling sand simulation in p5.js using a grid of pixels and simple rules. Code: https://thecodingtrain.com/challenges...

🚀 Watch this video ad-free on Nebula https://nebula.tv/videos/codingtrain-...

p5.js Web Editor Sketches:
🕹️ Falling Sand: https://editor.p5js.org/codingtrain/s...
🕹️ Falling Sand with Gravity: https://editor.p5js.org/codingtrain/s...

🎥 Previous: Coding Challenge 179: Elementary Cell...
🎥 All: Coding Challenges

References:
🔗 Genuary: https://genuary.art/
🔗 Sandspiel by Max Bittker: https://sandspiel.club/
🔗 Making a falling sand simulator: https://jason.today/falling-sand
📕 The Nature of Code by Daniel Shiffman: https://natureofcode.com/

Videos:
🎥 Noita 1.0 Launch Trailer by Nolla Games: Noita 1.0 Launch Trailer
🚂 Wolfram CA: Coding Challenge 179: Elementary Cell...
🚂 The Game of Life: Coding Challenge #85: The Game of Life

Related Coding Challenges:
🚂 179 Wolfram CA: Coding Challenge 179: Elementary Cell...
🚂 85 The Game of Life: Coding Challenge #85: The Game of Life
🚂 107 Sandpiles: Coding Challenge #107: Sandpiles
🚂 132 Fluid Simulation: Coding Challenge #132: Fluid Simulation
🚂 102 2D Water Ripple: Coding Challenge 102: 2D Water Ripple

Timestamps:
0:00 Introduction and references
2:10 About cellular automata
2:47 The rules for a sand simulation
3:36 Code! Creating a grid
5:04 Animating a falling grain of sand
7:32 About matrix columns and rows
8:04 Let's account for the bottom edge
9:09 Adding mouse interaction
9:42 More sophisticated sand behavior
10:43 Oops! Some errors to fix
11:30 Adding randomness
12:26 Handling left and right edges
14:00 Checking if mouse is within the canvas
14:40 Making it more efficient
14:56 More space and more sand
16:55 Adding some color!
18:54 Challenge complete! Let's do some refactoring
20:58 How could we add gravity?
21:57 Wrapping up

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

🚂 Website: https://thecodingtrain.com/
👾 Share Your Creation! https://thecodingtrain.com/guides/pas...
🚩 Suggest Topics: https://github.com/CodingTrain/Sugges...
💡 GitHub: https://github.com/CodingTrain
💬 Discord: https://thecodingtrain.com/discord
💖 Membership: http://youtube.com/thecodingtrain/join
🛒 Store: https://standard.tv/codingtrain
🖋️ Twitter: Twitter: thecodingtrain
📸 Instagram: Instagram: the.coding.train

🎥 Coding Challenges: Coding Challenges
🎥 Intro to Programming: Start learning here!

🔗 p5.js: https://p5js.org
🔗 p5.js Web Editor: https://editor.p5js.org/
🔗 Processing: https://processing.org

📄 Code of Conduct: https://github.com/CodingTrain/Code-o...

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecod...

#pixels #simulation #fallingsand #fluidsimulation #sandpilemodel #generativeart #p5js #javascript
6 ماه پیش در تاریخ 1402/11/02 منتشر شده است.
814,815 بـار بازدید شده
... بیشتر