xxxxxxxxxx
259
let p=70
// let x=20
// let y=110
let myArray1=[420,480,360,660,300,600,780];//red assignments hours
let myArray2=[240,310,380,340,445,280,195];//blue sleep hours
let myLocation=[5,5+p,5+2*p,5+3*p,5+4*p,5+5*p,5+6*p]
let index=0
let myCircleY=0
let myCircleX=0
let myArrayX=[0,40,80,150,170,210,230]
let myArrayY=[0,400,100,350,50,550,220]
function setup() {
createCanvas(600, 600);
}
function draw() {
background(0);
// angleMode(DEGREES)
//sweat
moveCircle()
function moveCircle(){
myCircleY = myCircleY + 1
if (myCircleY > height ) {
myCircleY= 0
}
myCircleX = myCircleX + 1
if (myCircleX > width || myCircleX > 300 ) {
myCircleX=0
}
//sweats
for (let p = 0; p < 7; p++) {
noStroke();
fill(255);
triangle(121+myArrayX[p],(myCircleY-4-myArrayY[p])*2,130+myArrayX[p], (myCircleY-20-myArrayY[p])*2,139+myArrayX[p],(myCircleY-4-myArrayY[p])*2)
ellipse(130+myArrayX[p],(myCircleY-myArrayY[p])*2,20,30);
triangle(141+myArrayX[p],myCircleY-26-myArrayY[p],150+myArrayX[p], myCircleY-50-myArrayY[p],159+myArrayX[p],myCircleY-26-myArrayY[p])
ellipse(150+myArrayX[p],myCircleY-myArrayY[p]-20,20,30)
//ZZ
textSize(30)
textStyle(BOLD)
text("Z",450+myArrayX[p], 650-myCircleY-myArrayY[p])
}
myRect(255,255,255,20,110,80,30,20)
function myRect(r,g,b,x,y,w,h,t){
//white boxes:days
fill(200);
noStroke();
rect(x,y,w,h) //20,110,80,30
rect(x,y+p,w,h)
rect(x,y+p*2,w,h)
rect(x,y+p*3,w,h)
rect(x,y+p*4,w,h)
rect(x,y+p*5,w,h)
rect(x,y+p*6,w,h)
//text:days
textSize(15)
fill(0)
text("DAY 1",x+20,y+20)
text("DAY 2",x+20,y+20+p)
text("DAY 3",x+20,y+20+p*2)
text("DAY 4",x+20,y+20+p*3)
text("DAY 5",x+20,y+20+p*4)
text("DAY 6",x+20,y+20+p*5)
text("DAY 7",x+20,y+20+p*6)
//red box:assignment
fill(r,0,0) ;
rect(x+135,y-80,w+50,h+10);//x=20,y=110 w=80,h=30
//eyes
fill(r);
ellipse(200,50,20,30)
ellipse(240,50,20,30)
fill(0);
ellipse(200,50,15)
ellipse(240,50,15)
if(mouseY>30 && mouseY<70 && mouseX>155 && mouseX<285){
textSize(16)
fill(0,g,0)
text("ASSIGNMENTS",x+142,y-85)
}
//bluebox:sleep
fill(0,g-200,b-50) ;
rect(x+400,y-80,w+50,h+10) //x=20,y=110 w=80,h=30
//eyes
push()
noFill();
stroke(0)
arc(460,50,30,10,0,PI)
arc(510,50,30,10,0,PI)
line(460,55,455,60)
line(450,55,445,60)
line(510,55,515,60)
line(520,55,525,60)
pop()
if(mouseY>30 && mouseY<70 && mouseX>420 && mouseX<550){
fill(0,g,0)
textSize(16)
text("SLEEP",x+435,y-85)
}
// Assingment bar
for (let i = 0; i < 7; i++) {
fill(r,0,0)
noStroke();
rect(x+100,y+myLocation[i],myArray1[i]/2.2,h-10) ;
//assignments hours text
if(mouseY>30 && mouseY<70 && mouseX>155 && mouseX<285){
textSize(16)
fill(0,g,0)
text("ASSIGNMENTS",x+142,y-85)
text(myArray1[i]/60+' '+"hours",x+150, y+myLocation[i]-5);
text(myArray1[i]/60+' '+"hours",x+150, y+myLocation[i]-5);
}
// assignments bars boolean
let myArray3=[120,110+myLocation[i],120+myArray1[i]/2.2,110+myLocation[i]+20]
if(mouseY>myArray3[1] && mouseY<myArray3[3] && mouseX>myArray3[0] && mouseX<myArray3[2]){
fill(0,g,0)
text(myArray1[i]/60+' '+"hours",x+150, y+myLocation[i]-5);
text(myArray1[i]/60+' '+"hours",x+150, y+myLocation[i]-5);
}
//sleep bar
for (let i = 0; i < 7; i++) {
fill(0,0,b)
noStroke();
rect(x+560,y+myLocation[i],-(myArray2[i]/2.2),h-10) ;//x=20, y=110
//sleep hours text
if(mouseY>30 && mouseY<70 && mouseX>420 && mouseX<550){
fill(0,g,0)
textSize(16)
text("SLEEP",x+435,y-85)
text(int(myArray2[i]/60)+' '+"hours"+' '+myArray2[i]%60+' '+"minutes",x+430, y+myLocation[i]-5)
}
// sleep bars boolean
let myArray4=[580,110+myLocation[i],580-myArray2[i]/2.2,110+myLocation[i]+20]
if(mouseY>myArray4[1] && mouseY<myArray4[3] && mouseX>myArray4[2] && mouseX<myArray4[0]){
fill(0,g,0)
text(int(myArray2[i]/60)+' '+"hours"+' '+ myArray2[i] % 60+' '+"minutes",x+430, y+myLocation[i]-5);
}
}
}
//vetical line bar
stroke(255)
strokeWeight(3)
line(x+100,y-10,x+100,y+470)
line(x+560,y-10,x+560,y+470)
if (mouseIsPressed) {
fill(r,g,0)
rect(0,0,600,600)
textSize(100)
fill(0)
text("I WANT TO",50,350)
text("SLEEP!",120,480)
//sleepy eyes
push()
noStroke();
rotate(-QUARTER_PI/3)
fill(255);
arc(150,200,140,140,0,TWO_PI,OPEN)
pop()
push()
noStroke();
fill(255);
rotate(QUARTER_PI/3)
arc(370,62,140,140,0,TWO_PI,OPEN)
pop()
//black eyeball
noStroke();
fill(0);
ellipse(200,160,40,40);
ellipse(340,160,40,40);
//eyelid
push()
noStroke()
rotate(-QUARTER_PI/3)
fill(255, 204, 153);
arc(150,200,140,170,PI,TWO_PI,OPEN)
pop()
push()
noStroke();
fill(255, 204, 153);
rotate(QUARTER_PI/3)
arc(370,61,140,170,PI,TWO_PI,OPEN)
pop()
push()
fill(0, 204, 255)
rotate(QUARTER_PI/3)
textSize(80)
textStyle(BOLD)
text("Z",500,50);
pop()
push()
fill(0, 204, 255)
rotate(QUARTER_PI/5)
textSize(60)
textStyle(BOLD)
text("Z",450,30);
pop()
}
}
}}