Skip to content

Instantly share code, notes, and snippets.

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