The code is below if you are interested!
int hours;
String period;
int r = 0;
int b = 0;
int g = 0;
float rchanger;
float gchanger;
float bchanger;
float rchanger2;
float gchanger2;
float bchanger2;
PImage head;
//Gif allFrames2;
Gif allFrames2;
PImage[] allFrames;
int f2 = 0;
int f = 0;
int msCheck1 = 250;
int minCheck;
void setup(){
size(800,800);
rchanger = 0;
gchanger = 0;
bchanger = 0;
rchanger2 = 0;
gchanger2 = 0;
bchanger2 = 0;
//head = loadImage ("head.png");
allFrames2 = new Gif (this, "AlienBlink.gif");
// allFrames2 = Gif.getPImages(this, "head.png");
allFrames = Gif.getPImages(this, "AlienBreathe.gif");
}
void draw(){
rchanger = map(hour(), 1, 12, 205, 0);
gchanger = map(hour(), 1, 12, 201, 0);
bchanger = map(hour(), 1, 12, 255, 0);
rchanger2 = map(hour(), 12, 23, 0, 205);
gchanger2 = map(hour(), 12, 23, 0, 201);
bchanger2 = map(hour(), 12, 23, 0, 255);
background(255);
hours= hour();
if (hour() > 12){
hours = hour() - 12;
period = "PM";
}else{
hours = hour();
period = "AM";
}
{
//println(hour() + ":" + minute() + ":" + second() + period);
background (255, 255, 230);
textAlign(CENTER);
fill (0);
text(hours + ":" + minute() + ":" + second() + " " + period, width/2, height/2);
// jump1();
// jump2();
// jump3();
dimmer();
//create variable for hour minuetes and seconds
}
if(millis() > msCheck1){
msCheck1 += 500;
f++;
}
if(f > 7){
f = 0;
}
image(allFrames[f], 330,530);
image(allFrames2, 40,120);
if(minCheck != minute()){
println("A minute has passed.");
allFrames2.play();
}
if(f2 > 7){
f2 = 0;
}
minCheck = minute();
//image(allFrames2[f], 100,300);
/*
if(minute() >= 31){
image(allFrames2,50, 100);
}
else if (minute() <= 31){
image(head, 100, 105);
}
*/
}
//END OF TAB ONE
void dimmer(){
fill(rchanger, gchanger, bchanger);
if(hour() >= 1){
strokeWeight(0); stroke(0,0,0,0);
fill(rchanger, gchanger, bchanger);
rect(0,0,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,66.7,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,133.4,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,200.1,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,266.8,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,333.5,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,400.2,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,466.9,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,466.9,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,533.6,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,600.3,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,677,width,150);
fill(rchanger, gchanger, bchanger);
rect(0,733.7,width,150);
}else if (hour() >= 12){
strokeWeight(0); stroke(0,0,0,0);
fill(rchanger2, gchanger2, bchanger2);
rect(0,0,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,66.7,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,133.4,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,200.1,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,266.8,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,333.5,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,400.2,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,466.9,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,466.9,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,533.6,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,600.3,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,677,width,150);
fill(rchanger2, gchanger2, bchanger2);
rect(0,733.7,width,150);
}
}
/* fill(mouseY-70,mouseY-50,mouseY);
/stroke(0,0,0,0); strokeWeight(0);
fill(#03A9FF,120);
// rect(0,0,width,500);
fill (255,255,240); ellipse (250, 250, 5,5);
ellipse (470, 200, 5,5);
ellipse (780, 60, 5,5);
ellipse (100, 30, 5,5);
ellipse (600, 380, 5,5);
ellipse (360, 300, 5,5);
ellipse (400, 20, 5,5);
ellipse (550, 150, 10,10);
ellipse (500, 100, 10,10);
ellipse (300, 20, 10,10);
ellipse (660, 370, 10,10);
ellipse (750, 260, 10,10);
ellipse (10, 240, 10,10);
ellipse (490, 320, 10,10);
ellipse (170, 280, 10,10);
ellipse (90, 250,10,10);
*/
No comments:
Post a Comment