Coding Challenge 185: Unfolding Fractals
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