|
||||||
|
||||||
Free Flash Tutorial - Analogue Clock

Free
Flash Tutorial
Step Six: Setting up the Clock
It is now time to assemble all of these different clock parts and put them altogether so that we can create a working clock:

Note: We will later use these two frames to create a loop. It is easier to create the double frame now as subsequent Layers will automatically have two frames.
Note: Your clock face should now be in the centre of the Stage.
The Hour Hand





// Gets the seconds as a number
var seconds = myTime.getSeconds();
/* Uses the above number
to rotate the second hand. The multiplication by 6 is because there
are 60 seconds in a minute but 360° in a circle
ie: 6x60=360 */
mySecondHand._rotation = seconds*6;
//As above but for the Minute hand
var minutes = myTime.getMinutes();
myMinuteHand._rotation = minutes*6;
/* As above but for the hour hand. The equation is different because
there are 24 hours in a day. ie: 24x30=720. In other words the hour hand
rotates twice in a day. 360x2=720. */
var hours = myTime.getHours();
myHourHand._rotation = hours*30;
/* The above equation makes
the Hour hand point to the exact hour. This is ok for the minute and
second hands but not the hour hand. At half past you want the hour
hand between the two clock digits. At ten to the hour you want the
hour hand to be nearly at the next number on the clock face. So the
equation below adds a small amount of rotation depending on how many
minutes have past the hour: 1/2° every minute. */
myHourHand._rotation += (minutes/2);

|
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
|
|
|
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|