Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Analogue clock using GD

Status
Not open for further replies.

chrismassey

Programmer
Aug 24, 2007
264
GB
Hello,

I am currently creating an analogue clock using GD. I currently have a square (400px by 400px) and a large circle in the middle.

Each of the 2 clock hands are lines with an xy co-ordinate for one end of the line, and another xy co-ordinate for the other end of the line. To change the hour and minute hand according to GMT time I am going to have to do some pretty complex mathematical equations. the first xy co-ordinate for both clock hands will always be the same (200, 200) as this is the middle of the circle. Then for i.e. the hour hand, I will need to find some sort of relationship between the hour and the position of the other xy co-ordinate. For starters - when hour is 12 or 24, then the other xy co-ordinate is 200, 10 (the middle (x) and 10 down from the top (y)...

Now this might be pretty complicated, however I was wondering if someone has had to complete a similar task and has got any suggestions or ideas on working out the relationship?

Chris
 
Right, I have just found that this command is available...

$image->copyRotated($sourceImage,$dstX,$dstY,

Rotate the first line, from a point of rotation. Perfect, no relationships needed.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top