Skip to content

Instantly share code, notes, and snippets.

@fiskurgit
Last active August 19, 2019 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fiskurgit/ffc649d14076463df7c6389d7ccb5f35 to your computer and use it in GitHub Desktop.
Save fiskurgit/ffc649d14076463df7c6389d7ccb5f35 to your computer and use it in GitHub Desktop.
// 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();
}
}
@fiskurgit
Copy link
Author

Screen Shot 2019-08-19 at 16 22 33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment