Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2017 17:22
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 anonymous/d002d99b90b2288ee6f8f3a16ee49c2e to your computer and use it in GitHub Desktop.
Save anonymous/d002d99b90b2288ee6f8f3a16ee49c2e to your computer and use it in GitHub Desktop.
My first attempt
PVector target, loc, vel;
PVector[] points;
float ease = 0.3;
boolean easing = true;
int q, w, num = 150;
int[] vals;
void setup() {
size(900, 900, P2D);
noStroke();
points = new PVector[num];
for (int i = 0; i < num; i++) {
points[i] = new PVector(width/2, height/2);
}
}
void draw() {
background(#222C32);
noStroke();
loc = new PVector(width/2,height/2);
vel = new PVector();
target = new PVector(mouseX,mouseY);
for(int i = 0; i < num; i++) {
loc = points[i];
PVector distance = PVector.sub(target, loc);
vel = PVector.mult(distance, ease);
loc.add(vel);
target = loc;
fill(255-i*2, 220-i*1, 120-i*0.2);
ellipse(loc.x, loc.y, num-i, num-i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment