Coding Challenge #13: Reaction Diffusion Algorithm in p5.js
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