Skip to content

Instantly share code, notes, and snippets.

@ptvans
Created September 23, 2013 16:25
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 ptvans/6673116 to your computer and use it in GitHub Desktop.
Save ptvans/6673116 to your computer and use it in GitHub Desktop.
processing basics
{"description":"processing basics","endpoint":"","display":"canvas","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.pde":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/k7qAEye.png"}
// http://processingjs.org/learning/
// Global variables
float radius = 120;
int X, Y;
int nX, nY;
int delay = 10;
// Setup the Processing Canvas
void setup(){
size( tributary.sw, tributary.sh );
strokeWeight( 26 );
frameRate( 55 );
X = width / 2;
Y = height / 2;
nX = X;
nY = Y;
}
// Main draw loop
void draw(){
radius = radius + sin( frameCount / 18 );
// Track circle to new destination
X+=(nX-X)/delay;
Y+=(nY-Y)/delay;
// Fill canvas grey
background( 229 );
// Set fill-color to blue
fill( 0, 155, 184 );
// Set stroke-color white
stroke(105, 220, 1890);
// Draw circle
ellipse( X, Y, radius, radius );
}
// Set circle's next destination
void mouseMoved(){
nX = mouseX;
nY = mouseY;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment