Coding Challenge #15: Object Oriented Fractal Trees

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



Duration: 22:59
237,448 views
4,440


More algorithmic botany! Another way to generate a fractal tree is to consider every part of the tree an object, so that we can apply forces and attributes to all the branches and leaves and more! Code: https://thecodingtrain.com/challenges/15-object-oriented-fractal-trees

๐Ÿ•น๏ธ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/JDT5wrxVj

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

References:
๐ŸŒฟ Algorithmic Botany: http://algorithmicbotany.org/
๐Ÿ“• My NOC class on Kadenze: https://www.kadenze.com/courses/the-nature-of-code/info

Videos:
๐ŸŽฅ Algorithmic Botany Track: https://thecodingtrain.com/tracks/algorithmic-botany
๐Ÿ”ด Coding Train Live 40: https://youtu.be/MwLyeEWnMCY?t=3153s

Related Coding Challenges:
๐Ÿš‚ #14 Recursive Fractal Trees: https://youtu.be/0jjeOYMjmDU
๐Ÿš‚ #16 Fractal Trees - L-System: https://youtu.be/E1B4UoSQMFw
๐Ÿš‚ #174 AppleSoft Basic Fractal Tree: https://youtu.be/UNkHditYGls

Timestamps:
0:00 Introducing today's topic
1;44 Write a Branch constructor function
3:00 Add a single Branch object for the root of the tree
5:53 Add a tree array
7:20 Write a branch object to created 2 attached branch objects
9:30 Create a direction vector that points from the beginning to the end of the vector
10:12 Determine new end point
11:00 Add a new branch to the right
12:00 Add a new branch to the left
13:00 Shrink the branches
14:39 Push new branches to the tree when the mouse is pressed
15:37 Loop through the array backwards
16:12 Deal with duplicate branches
17:31 Add a jitter function
19:52 Add leaves at the end of the branches
21:58 Have the leaves fall
22:45 Thanks for watching!

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

#fractals #objectorientedprogramming #generativeart #algorithmicbotany #p5js #javascript







Tags:
challenge
coding
object
object oriented programming
tree
coding challenge
oop
tutorial
object oriented
fractal
creative coding
programming challenge
pvector
nature of code
processing
p5.js
javascript
recursion
p5.js tutorial
fractals
p5js
programming
daniel shiffman processing
javascript (programming language)
botany
algorithmic botany