//Roy Evan Lobosco //CAP4800 public TOKEN sechand = new TOKEN(); public int DRAW = 0,event; public BImage kat; void setup() { Sim.init(minute()*60+second(),Const.HEAP); //set up all my stuff size(310, 594); background(255); kat = loadImage("kat.jpg"); image(kat, 0, 0); ellipseMode(CENTER_DIAMETER); smooth(); fill(160); stroke(255); //seconds junk sechand.attr[0] = (float) (0); int s = second(); sechand.attr[0] += (PI/30)*s; sechand.attr[1] = (float) (0); int m = minute(); sechand.attr[1] += (PI/30)*m; sechand.attr[2] = (float) (0); int h = hour(); sechand.attr[2] += (PI/6)*h; sechand.attr[3] = (double) 230; sechand.attr[4] = (double) 90; boolean a = true; int j=0; for(int i=1; i<3600; i++) { Sim.schedule(DRAW, j, sechand); j+=1; sechand.attr[0] += (PI/30); s+=1; if(s%60==0) { sechand.attr[1] += (PI/30); } if(s%3600==0) { sechand.attr[2] += (PI/6); } if(sechand.attr[3]==250) a=false; if(sechand.attr[3]==210) a=true; if(a==false) { sechand.attr[3] -= 2; sechand.attr[4] -= 2; } else { sechand.attr[3] += 2; sechand.attr[4] += 2; } } } void loop() { float secangle; float minangle; float hourangle; int eye; int lie; //seconds event int event = Sim.next_event(sechand,minute()*60+second(),Const.SYNC); if(event == DRAW) { secangle = (float) sechand.attr[0]; minangle = (float) sechand.attr[1]; hourangle = (float) sechand.attr[2]; background(255); kat = loadImage("kat.jpg"); image(kat, 0, 0); //eye stuff fill(0, 210); stroke(0, 210); eye = (int) sechand.attr[3]; lie = (int) sechand.attr[4]; ellipse(eye, 94, 26, 74); ellipse(lie, 94, 26, 74); //hands stuff fill(255); stroke(255); translate(158, 438); push(); rotate(secangle); ellipse(0, -71, 1, 112); pop(); push(); rotate(minangle); ellipse(0, -65, 5, 100); pop(); rotate(hourangle); ellipse(0, -52, 10, 77); } }