sync on color backdrop 0 autocam off `set the ink colour to green ink rgb(0,255,0),0 `draw a 2d box to represent the second hand box 49,0,51,50 `grab the image and store as image 1 get image 1,0,0,100,100,1 `clear the screen cls `as above for the minute hand, but a little bit of a thicker box box 48,0,51,50 get image 2,0,0,100,100,1 cls `same again for the hour hand, but a bit shorter this time box 48,20,51,50 get image 3,0,0,100,100,1 cls `Now for the dial. We want twelve small boxes aranged in a circle `set up a loop to repeat 12 times for n=1 to 12 `draw a box using the equation for a circle: x=radius*cos(angle), y=radius*sin(angle) box 98+90*cos(theta#),98+90*sin(theta#),102+90*cos(theta#),102+90*sin(theta#) `increase the angle by 30 degrees (360 degrees in a circle, divided by 12 digits around the dial) inc theta#,30 next n `grab the image get image 4,0,0,200,200,1 `make a plane for the second hand make object plain 1,1,1 `position it at the front - ie infront of the other planes to follow position object 1,0,0,-0.03 `set lighting off, so it appears full brightness set object light 1,0 `texture it with the image of the second hand texture object 1,1 `make it transparent so we can see the other planes behind it set object transparency 1,1 `repeat for the minute hand make object plain 2,1,1 position object 2,0,0,-0.02 set object light 2,0 texture object 2,2 set object transparency 2,1 `and the hour hand make object plain 3,1,1 position object 3,0,0,-0.01 set object light 3,0 texture object 3,3 set object transparency 3,1 `and the dial make object plain 4,1.2,1.2 set object light 4,0 texture object 4,4 `and finally make a box for the clock make object box 5,1.4,1.4,0.5 color object 5,rgb(50,50,50) position object 5,0,0,0.26 do `get the actual time, as a string in the format hh:mm:ss t$=get time$() `get the value of the two right hand digits (ie the seconds) `and multiply the number of seconds by 6 to get the number of degrees rotation `(Why 6? 360 degrees in a circle divided by 60 seconds, means each second is 6 degrees) s#=val(right$(t$,2))*6 `get the middle two digits (mins) - ie the two leftmost of the 5 rightmost digits, not forgetting the ":" `multiply by 6 to convert the value of minutes into degrees rotation `and add a 60th of the angle of the second hand - eg if the second hand `is on 30 seconds (180 degrees), then the minute hand needs to have on by an extra half a minute - or 180/60=3 degrees. m#=(val(left$(right$(t$,5),2))*6)+s#/60.0 `get the two leftmost digits (hours) and multiply by 30 `(360 divided by twelve hours gives 30 degrees rotation per hour) `add on a 12th of the angle of the minute hand h#=(val(left$(t$,2))*30)+m#/12.0 `rotate the 3 planes about their z axis by the calculated angle (negative as z-angles are given in the anticlockwise direction) zrotate object 1,-s# zrotate object 2,-m# zrotate object 3,-h# `just some fancy stuff to move the camera a bit position camera 2*cos(theta#),-0.2,2*sin(theta#) theta#=270+40*sin(alpha#) inc alpha#,0.2 point camera 0,0,0 sync loop