Coding Challenge 185: Unfolding Fractals

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



Duration: 0:00
49,821 views
2,168


25% off The Nature of Code book with code CHOOCHOO at https://natureofcode.com/ (comes with exclusive sticker+bookmark).

The Dragon Curve fractal is created by repeatedly folding a strip of paper in half, then unfolding it to form a curve. In this challenge, I attempt to code an animation of the Dragon Curve forming with p5.js in JavaScript. Code: https://thecodingtrain.com/challenges/185-dragon-curve

šŸš€ Watch this video ad-free on Nebula https://nebula.tv/videos/codingtrain-coding-challenge-184-dragon-curve

p5.js Web Editor Sketches:
šŸ•¹ ļø Dragon curve animation:https://editor.p5js.org/codingtrain/sketches/LXDsoCSZs.
šŸ•¹ ļø Dragon curve color variationhttps://editor.p5js.org/codingtrain/sketches/7nNd-f7iY..
šŸ•¹ ļø Dragon curve noise variatiohttps://editor.p5js.org/codingtrain/sketches/7r7ZIE4dc...

šŸŽ„ Previous:    • CollisionsĀ WithoutĀ aĀ PhysicsĀ Library!...Ā Ā 
šŸŽ„ All:    • CodingĀ ChallengesĀ Ā 

References:
šŸ“• The Nature of Codhttps://natureofcode.com/om/
šŸ›’ Nature of Code shop..
šŸ”— Dragon Curvehttps://en.wikipedia.org/wiki/Dragon_curve..
šŸ”— concat() functionhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat..

Videos:
šŸŽ„    • UnfoldingĀ TheĀ DragonĀ |Ā FractalĀ CurveĀ |Ā Ā 
šŸŽ„    • DragonĀ CurveĀ -Ā NumberphileĀ Ā 

Related Coding Challenges:
šŸš‚    • CodingĀ ChallengeĀ #14:Ā FractalĀ TreesĀ -...Ā Ā 
šŸš‚    • CodingĀ ChallengeĀ #16:Ā L-SystemĀ Fracta...Ā Ā 
šŸš‚    • CodingĀ ChallengeĀ #77:Ā RecursionĀ Ā 
šŸš‚    • CodingĀ ChallengeĀ #121:Ā LogoĀ InterpreterĀ Ā 
šŸš‚    • CodingĀ theĀ HilbertĀ CurveĀ Ā 

Timestamps:
00:00 Introduction
00:36 The Nature of Code book
01:43 Explain algorithm
03:38 Start coding
05:05 Write rotate function
07:05 Rotate all the segments
11:30 We have the dragon curve!
12:00 Add animation
16:31 Add the starting positions for a and b
21:43 Scale the lines
24:08 Add a nextGeneration() function
25:16 The reduction ratio
26:44 Target zoom
28:57 Challenge complete!
29:57 What can you do?
30:25 Outro

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

šŸš‚ Websitehttps://thecodingtrain.com/m/
šŸ‘¾ Share Your Creationhttps://thecodingtrain.com/guides/passenger-showcase-guide..
🚩 Suggest Topicshttps://github.com/CodingTrain/Suggestion-Box..
šŸ’” GitHubhttps://github.com/CodingTrainin
šŸ’¬ Discordhttps://thecodingtrain.com/discordrd
šŸ’– Membershipin
šŸ›’ Store:https://standard.tv/codingtrainn
šŸ–‹ ļø Twitterhttps://twitter.com/thecodingtrainĀ Ā 
šŸ“ø Instagramhttps://www.instagram.com/the.coding.train/Ā Ā 

šŸŽ„    • CodingĀ ChallengesĀ Ā 
šŸŽ„    • StartĀ learningĀ here!Ā Ā 

šŸ”— p5.jshttps://p5js.org/rg
šŸ”— p5.js Web Editorhttps://editor.p5js.org/g/
šŸ”— Processinghttps://processing.org/rg

šŸ“„ Code of Conducthttps://github.com/CodingTrain/Code-of-Conduct..

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

#fractals #dragoncurve #natureofcode #p5js #javascript