0

Please I need an explanation from lines 58 to the end

Studying HTML graphics and saw this code for building an analog clock on a site.Now I don't understand the reasons for the negative radius in the code from lines 58 and why the Math.PI/6 https://code.sololearn.com/WrTqew0uY98A/?ref=app

25th Sep 2022, 9:00 PM
steve Purpose
steve  Purpose - avatar
9 odpowiedzi
+ 1
Math.PI radians is 180 degrees Math.PI/6 is 30 degrees, the angle between the numbers of the clockface. The radius also happens to be the height/2. the negative radius is used in the translate function to re center the number after the rotation.
27th Sep 2022, 9:02 AM
Bob_Li
Bob_Li - avatar
0
Change the numbers to see what happens.
25th Sep 2022, 9:19 PM
Chris Coder
Chris Coder - avatar
0
I did that earlier Chris Coder ...why the ang = num *Math.pI/6 .I do that and the results are not even angular
25th Sep 2022, 10:29 PM
steve Purpose
steve  Purpose - avatar
0
It's all jumbled up..spent more than an hour trying to figure it out
25th Sep 2022, 10:30 PM
steve Purpose
steve  Purpose - avatar
0
Well Chris Coder ,but this is not how I like to learn..I like knowing the theory behind whatever is done,so that I can face a similar issue.
26th Sep 2022, 8:31 AM
steve Purpose
steve  Purpose - avatar
0
I need to understand the code..Done all sorts of trial and error and I can't decipher the code
26th Sep 2022, 8:32 AM
steve Purpose
steve  Purpose - avatar
0
Thanks Bob_Li ,I'll make sure,I check out more on that negative radius and re center.
27th Sep 2022, 10:55 AM
steve Purpose
steve  Purpose - avatar
0
don't think of it as radius in translate. Think of it as height/2 look how radius was computed at the beginning of the code.
27th Sep 2022, 11:10 AM
Bob_Li
Bob_Li - avatar