Skip to content

Instantly share code, notes, and snippets.

@doomspork
Last active September 28, 2015 03:48
Show Gist options
  • Save doomspork/1379372 to your computer and use it in GitHub Desktop.
Save doomspork/1379372 to your computer and use it in GitHub Desktop.
Processing(.js) sketch of a "cell" pulsing.
// comments go here
boolean expanding = true;
int change = 0;
void setup()
{
size(200,200);
background(125);
fill(255);
frameRate(10);
}
void draw(){
background( 100 );
stroke(0, 0, 0);
change += (expanding) ? 1 : -1;
if(change == 0) {
expanding = true;
} else if(change >= 5) {
expanding = false;
}
noFill();
bezier(110, 50, 150 + (change * 2), 5, 150 + (change * 2), 145, 110, 100);
bezier(110, 50, 105, 55 + (change), 95, 55 + (change), 90, 50);
bezier(110, 100, 105, 95 - (change), 95, 95 - (change), 90, 100);
bezier(90, 50, 50 - (change * 2), 5, 50 - (change * 2), 145, 90, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment