Skip to content

Instantly share code, notes, and snippets.

@Nekodigi
Created February 25, 2020 14:43
Show Gist options
  • Save Nekodigi/1a43f4385b9f1527b44a8ad378911ccb to your computer and use it in GitHub Desktop.
Save Nekodigi/1a43f4385b9f1527b44a8ad378911ccb to your computer and use it in GitHub Desktop.
float toff = 0;
void setup(){
fullScreen();
//size(1000, 500);
strokeWeight(5);
background(255);
}
void draw(){
fill(255, 50);
rect(0, 0, width, height);
//background(255);
noStroke();
fill(0);
for(int i = 0; i < width; i+=200){
float t = map(i, 0, width, 0, 1);
ellipse(i, EaseInOutCubic(height-height/4, height/4, abs((t+toff)%2-1)), 60, 60);
}
toff += 0.01;
}
float EaseInOutCubic(float start, float end, float t){
end -= start;//calculate difference
return t<0.5 ? end*4*t*t*t+start : end*(4*(t-1)*(t-1)*(t-1)+1)+start;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment