M
M
ML2017-02-20 14:01:16
JavaScript
ML, 2017-02-20 14:01:16

How to position text?

I wrote this script https://jsfiddle.net/3vh8zph4/1/
Now I need to place the numbers, but I can't figure out how to position them.
That is, what exactly refers to what, it turns out this crap https://jsfiddle.net/3vh8zph4/2/
I'm trying to achieve the result, as in the picturea1fd2fadddd344bb86d83e0e013a8e0e.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GreatRash, 2017-02-21
@staffID

You need to know only three things, and you should already know them anyway:
1) the center of the circle
2) the radius of the circle
3) the angle of rotation
Then, for the blue arc:
1) we know its beginning - 170 °, we know its end - 350 °
2) we find the angle of rotation: 350 - 170 = 180°
3) we find half of the angle: 180 / 2 = 90°
4) we postpone the resulting angle from the beginning of the arc: 170 + 90 = 260°
5) the radius is the hypotenuse, we also know the angle, which means the legs ( i.e. coordinates) are:
y = radius * sin(260°)
x = radius * cos(260°)
Sobsssno.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question