And you probably could thought that they made the code harder to understand, but have a reason, in a real clock the hour-pointer don't jump hours, so it doesn't passes of the 4 hour to 5 hour just jumping but will walk slowly to 5, so if we put just the calculation for the hour we would not see the hour-pointer slowly walking for the next hour but jumping for the next hour, in the school I studied the angle of the hour pointer, of course there we not use the moviment of the milliseconds the angle of the broke hours we calculated with the add of the minutes, so the full hour the hour-pointer is in the hour mark, but with the walk of the minutes the pointer-of the hours will be increasing in the direction of the next hour, so one hour is the 360° divide by the 12 hours, so is 360/12 each hour, and one minute inside that 360/12 is you have that 360/12 and add for each minutes + (360/12)/60, so you gonna add this for each minutes
1 minute = + (360/12)/60
2 minute = + (360/12)/60 + (360/12)/60;
15 minutes = + 15x( (360/12)/60)
// write Hours
ctx.rotate(hr * (Math.PI / 6) + (Math.PI / 360) * min + (Math.PI / 21600) *sec);
How in that clock we are considering the milliseconds we gonna put that info for the minutes
and in the seconds is just the milliseconds. Rute Bezerra de Menezes Gondim
No comments:
Post a Comment