Last active
August 19, 2019 18:05
-
-
Save fiskurgit/ffc649d14076463df7c6389d7ccb5f35 to your computer and use it in GitHub Desktop.
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 characters
// ND Lemniscate rainbow curve in Processing: https://processing.org/ | |
int iterations = 360; | |
int alphaDelta = 40; | |
int saturation = 170; | |
void setup(){ | |
size(800, 600); | |
noStroke(); | |
colorMode(HSB); | |
background(180); | |
} | |
void draw(){ | |
float x = sin(radians(frameCount)); | |
float y = sin(radians(frameCount)) * cos(radians(frameCount)); | |
if(frameCount < iterations){ | |
fill(map(frameCount, 0, iterations, 0, 255), saturation, 255); | |
}else{ | |
alphaDelta += 10; | |
fill(map(frameCount-iterations, 0, iterations, 0, 255), saturation, 255, 255 - alphaDelta); | |
} | |
translate(width/2, height/2); | |
ellipse(x * 275, y * 205, 75, 75); | |
if (frameCount == iterations + 30){ | |
noLoop(); | |
} | |
} |
Author
fiskurgit
commented
Aug 19, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment