Week 6, during the lesson, we learnt how to create time and clock in processing.
Time
We learnt how to create Time and Date in processing, I have learnt how to use the code:
text(“Time and Date”, 10, 30);
fill(#FFFFFF);
textSize(45);
text(hour(), 150, 100);
text(minute(),250,100);
text(second(),350,100);
text(day(),200,200);
text(month(),100,200);
text(year(),300,200);
This is how it look and I have understanding this code to create the time and date.
Clock
Firstly, I looked at it and how to create the clock animation but I couldn’t understand so I did some code.
void setup(){
size(600,600);
strokeWeight(20);
}
void draw () {
background(255,0,0);
stroke(second(),second());
line(second()*10,0,second()*10,600);
line(minute()*10,0,minute()*10,600);
stroke(#0AFFFD);
ellipse(300,300,second()*10,second()*10);
stroke(#0DFA2A);
ellipse(200,200,second()*10,second()*10);
}
and this is how it looks. I added another ellipse but it looks messy.
Clock (Understanding)
I have looked at it again and I have done processing again to create another clock to understand this code:
void setup(){
size(600,600);
strokeWeight(15);
}
void draw () {
background(#58FF50);
stroke(second(),second());
line(second()*10,0,second()*10,600);
line(minute()*10,0,minute()*10,600);
stroke(#FC1F1F);
ellipse(300,300,second()*10,second()*10);
}
This is how it looks like now and will continue practising.
Counter
I have learnt how to create images of numbers using processing and uploaded images.
I understand more now how to use processing.