Last active
May 24, 2022 11:10
Revisions
-
takawo revised this gist
May 24, 2022 . 1 changed file with 4 additions and 4 deletions.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 @@ -7,13 +7,13 @@ function draw() { background((95 / 100) * 255); push(); translate(width / 2, height / 2); let ratio = 0.01; let angle_num = 10; for (let i = 0; i < 10000; i++) { let bool = random() > 0.5; let angle = (int(random(angle_num)) * 360) / angle_num + ((recursiveRandom(3, bool) - 0.5) * 360) / angle_num / 2; let n = recursiveRandom(random(0, 5), bool); let r = 200 * n; let x = cos(angle) * r * (bool ? 1 - ratio : 1 + ratio); @@ -32,4 +32,4 @@ function recursiveRandom(count, bool = true) { count--; } return bool ? 1 - n : 1 + n; } -
takawo created this gist
May 24, 2022 .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,35 @@ function setup() { createCanvas(800, 800); angleMode(DEGREES); } function draw() { background((95 / 100) * 255); push(); translate(width / 2, height / 2); let ratio = 0; let angle_num = 4; for (let i = 0; i < 10000; i++) { let bool = random() > 0.5; let angle = (int(random(angle_num)) * 360) / angle_num + ((recursiveRandom(angle_num, bool) - 0.5) * 360) / angle_num / 2; let n = recursiveRandom(random(0, 5), bool); let r = 200 * n; let x = cos(angle) * r * (bool ? 1 - ratio : 1 + ratio); let y = sin(angle) * r * (bool ? 1 - ratio : 1 + ratio); strokeWeight(2 - abs(n - 1) * 2); point(x, y); } pop(); noLoop(); } function recursiveRandom(count, bool = true) { let n = 1; while (count > 0) { n *= random(); count--; } return bool ? 1 - n : 1 + n; }