Skip to content

Instantly share code, notes, and snippets.

@gregtemp
Created April 11, 2016 23:49
Show Gist options
  • Save gregtemp/93b94aa8df7314356bbb503021ac9b71 to your computer and use it in GitHub Desktop.
Save gregtemp/93b94aa8df7314356bbb503021ac9b71 to your computer and use it in GitHub Desktop.
lines moving around
int scene = 0;
void setup () {
//size (1280, 720);
size (displayWidth, displayHeight);
smooth();
noCursor();
}
void draw() {
background(0);
// --
//noStroke();
////fill(0,(mouseY/float(height) * 255.0));
//fill(0, 150);
//rect(0,0,width,height);
translate(width/2, height/2);
//rotate(radians(frameCount * 0.905));
rotate(radians(90));
translate(-width/2, -height/2);
switch(scene) {
case 0:
int topNum = 100;
for (int i = 0; i < topNum; i++) {
scene0(float(i)/float(topNum) /5.0, float(i)/float(topNum) * float(height));
}
break;
case 1:
break;
default:
break;
}
}
void scene0(float lineYspeed, float lineYoffset) {
//background(0);
//float lineYspeed = 0.25;
//float lineYoffset = 50;
float lineY = ((((millis()*lineYspeed) + lineYoffset) % height)*-1) + height;
strokeWeight(10);
stroke(abs((frameCount%510)-255));
line(width/2 - 10, lineY,width/2 + 20, lineY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment