Skip to content

Instantly share code, notes, and snippets.

@georgesb
Last active April 30, 2020 19:37
Show Gist options
  • Save georgesb/cb4238c5077c31583fff33e46770aa6e to your computer and use it in GitHub Desktop.
Save georgesb/cb4238c5077c31583fff33e46770aa6e to your computer and use it in GitHub Desktop.
Golden Ratio 2
<script src="https://cdn.jsdelivr.net/npm/p5"></script>
<script src="script.js"></script>
function setup() {
createCanvas(650, 450);
background(255, 170, 0, 95);
noStroke();
fill(30, 70);
let x = width / 2 + 182;
let y = height / 2;
let size = 8;
let phi = 1.618;
for (let i = 1; i <= 8; i++) {
size *= phi;
x = x - size / 5.3;
circle(x, y, size);
}
x = width / 2 - 182;
y = height / 2;
size = 8;
for (let i = 1; i <= 8; i++) {
size *= phi;
x = x + size / 5.3;
circle(x, y, size);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment