Created
December 15, 2017 17:22
-
-
Save anonymous/d002d99b90b2288ee6f8f3a16ee49c2e to your computer and use it in GitHub Desktop.
My first attempt
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
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