Last active
April 25, 2020 18:59
-
-
Save JohnPhamous/b5f28b72db44741eb5be512fc338d8f5 to your computer and use it in GitHub Desktop.
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
let itter = 1; | |
let max_itter = 10000; | |
let offset = 0; | |
let width = 800; | |
let height = 800; | |
let backgroundColor = "#14213d"; | |
let foregroundColor = "#fca311"; | |
function setup() { | |
pixelDensity(2); | |
createCanvas(width, height); | |
// noLoop(); | |
frameRate(5); | |
} | |
function draw() { | |
background(backgroundColor); | |
fill(backgroundColor); | |
stroke(foregroundColor); | |
for (let i = 0; i < itter; i++) { | |
let x = random(offset, width - offset); | |
let y = random(offset, height - offset); | |
let d = dist(width / 2, height / 2, x, y); | |
let decay = exp(-pow(d / 100, 2)) / sin(d); | |
ellipse(x, y, decay * 10); | |
} | |
let candi = itter + itter; | |
if (candi > max_itter) { | |
itter = max_itter; | |
} | |
else { | |
itter = candi; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment