Last active
May 3, 2020 06:08
-
-
Save georgesb/36ae5d5263fedc659930954a74283de7 to your computer and use it in GitHub Desktop.
Golden Spiral 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdn.jsdelivr.net/npm/p5"></script> | |
<script src="script.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
let x, y; | |
let fibonacci = [1, 1, 2, 3, 5, 8, 13, 21]; | |
createCanvas(650, 450); | |
background('#CAC7D7'); | |
translate(40, 40); | |
for (let i = 7; i >= 0; i--) { | |
x = fibonacci[i] * 17; | |
y = x; | |
strokeWeight(2); | |
stroke('#F4ED71'); | |
fill('#383140'); | |
rect(0, 0, x, y); | |
stroke('orange'); | |
strokeWeight(5); | |
push(); | |
translate(x, 0); | |
arc(0, 0, x * 2, y * 2, radians(90), radians(180)); | |
pop(); | |
translate(x, y); | |
rotate(radians(270)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment