Created
June 19, 2020 14:51
-
-
Save fewlinesofcode/c6a8650c09a68509a642c99dd74abb83 to your computer and use it in GitHub Desktop.
Revisions
-
fewlinesofcode created this gist
Jun 19, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ const s = (p) => { const w = 400; const h = 400; // Center coordinates const x0 = 200; const y0 = 200; // Radius const r = 150; var angle = 0; p.setup = () => { p.createCanvas(w, h); p.stroke(0, 0, 0, 10); p.background(225); }; p.draw = () => { var a, b = 0; var numPoints = 10; for(var i = 0; i <= numPoints; i++) { // Pillow var x = x0 + r * Math.cos(2 * Math.PI * i / numPoints - angle); var y = y0 + r * Math.sin(2 * Math.PI * i / numPoints + angle); if (i != 0) p.line(a, b, x, y); a = x; b = y; } angle += 1; }; }; let myp5 = new p5(s);