Skip to content

Instantly share code, notes, and snippets.

@andyinabox
Created April 17, 2017 20:15
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 andyinabox/e15d7715d03e13dd0897bfe1cabc6d5f to your computer and use it in GitHub Desktop.
Save andyinabox/e15d7715d03e13dd0897bfe1cabc6d5f to your computer and use it in GitHub Desktop.
Follow point in Processing
int h = 200;
PVector point;
PVector prev;
void setup() {
size(500, 500);
point = new PVector(mouseX, mouseY);
prev = point;
}
void draw() {
background(255);
point.x = point.x + (mouseX-point.x)/10;
point.y = point.y + (mouseY-point.y)/10;
line(mouseX, mouseY, point.x, point.y+h);
ellipse(mouseX, mouseY, 10, 10);
ellipse(point.x, point.y+h, 10, 10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment