Coding Challenge #13: Reaction Diffusion Algorithm in p5.js

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=BV9ny785UNc



Duration: 39:10
196,735 views
3,366


In this coding challenge, I visualize a Reaction Diffusion simulation using the Gray Scott model in JavaScript (with the p5.js library). Code: https://thecodingtrain.com/challenges/13-reaction-diffusion

πŸ•ΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/govdEW5aE

πŸŽ₯ Previous video: https://youtu.be/f0lkz2gSsIk?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Next video: https://youtu.be/0jjeOYMjmDU?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
πŸ“– Karl Sims' Reaction Diffusion Tutorial: http://karlsims.com/rd.html
πŸ““ 2D Array Tutorial: https://processing.org/tutorials/2darray/
πŸ“• My NOC class on Kadenze: https://www.kadenze.com/courses/the-nature-of-code/info

Videos:
πŸ”΄ Livestream Archive: https://youtu.be/FYRINCEDVKI?t=6697s

Related Coding Challenges:
πŸš‚ #85 The Game of Life: https://youtu.be/FWSR_7kZuYg
πŸš‚ #90 Floyd-Steinberg Dithering: https://youtu.be/0L2n8Tg2FwI
πŸš‚ #103 Fire Effect: https://youtu.be/X0kjv0MozuY

Timestamps:
0:00 Introducing today's topic
0:36 The Gray-Scott model
1:41 Key pieces of the algorithm
4:24 Convolutions
7:01 2D arrays
9:00 The grid stores the amount of a and b chemicals across every pixel
10:30 Create another array to store the next generation
11:37 Dealing with the pixel array
12:55 Set the pixel colors based on the amount of a and b
16:14 Write a function to swap the current and next grid
19:30 Add the reaction diffusion formulas to the code
24:27 Time steps
27:29 Add the Laplace functions
33:45 Seed a whole area with b
36:37 Recap of the code and suggestions for creative possibilities

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

πŸš‚ Website: http://thecodingtrain.com/
πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: https://github.com/CodingTrain
πŸ’¬ Discord: https://discord.gg/hPuGy2g
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: https://standard.tv/codingtrain
πŸ–‹οΈ Twitter: https://twitter.com/thecodingtrain
πŸ“Έ Instagram: https://www.instagram.com/the.coding.train/

πŸŽ₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— 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-of-Conduct

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

#math #reactiondiffusion #javascript #p5js







Tags:
coding challenge
javascript reaction diffusion
reaction diffusion algorithm
p5.js
reaction diffusion code
reaction diffusion
video
programming challenge
javascript (programming language)
nature of code
processing
daniel shiffman
p5js
javascript
coding
daniel shiffman processing
p5
challenge
algorithm art
visual algorithm
generative art
reaction
diffusion
gray scott
tutorial
gray scott reaction diffusion
creative coding
reaction-diffusion
gray-scott