xxxxxxxxxx
float s=0;
float speed;
void setup () {
size(800,800);
background(255);
smooth();
if (second()%5==1||second()%5==2){
s=second()-0.4;
}else{
s=second();
}
speed=0.02;
}
void draw () {
//Draw the background
fill(255);
noStroke();
rect(0,0,width,height);
//背景色
for (int i=4;i>0;i--){
fill(170+i*20);
ellipse(400,400,i*150,i*150);
}
//背景线条
noFill();
stroke(0);
strokeWeight(0.1);
for (int i=1;i<61;i++){
if(i%5==0){
strokeWeight(0.17)
arc(400,400,i*10,i*10,PI*5/6,PI*13/6)
}else{
strokeWeight(0.1)
arc(400,400,i*10,i*10,-HALF_PI,PI/6);
}
}
//时分秒
//时
strokeWeight(2);
if (hour()<12){
arc(400,400,50*(hour()),50*(hour()),PI*5/6,PI*3/2,PIE);
}else{
arc(400,400,50*(hour()-12),50*(hour()-12),PI*5/6,PI*3/2,PIE);
}
//分
strokeWeight(1);
arc(400,400,10*minute(),10*minute(),-HALF_PI,PI/6, PIE);
//秒
strokeWeight(0.5);
arc(400,400,10*s,10*s,PI/6, PI*5/6, PIE);
//改变参数
s+=speed;
if (second()%5==0 && second()!=0){
s=second();
}else if (second()==0){
s=0;
}
}