// night highway
// image of a stop light
PImage s;
float y;
float hval;
float sval;
void setup()
{
size(300, 300);
s = loadImage("stop2.jpg");
framerate(30);
colorMode(HSB);
smooth();
}
void draw()
{
background(0);
for(int i=0; i<width; i++) {
color c = s.pixels[int(y)*s.height + i];
stroke(c);
hval = hue(c);
sval = saturation(c);
line(i,150,150,150);
line(150, 150,200+i, 300);
}
if(hval < 50 && sval > 110) {
y = (y+1.25)% s.height;
} else {
y = (y+2)% s.height;
}
}