I want to do something similar as on this site
https://cssgradient.io/gradient-backgrounds/
Here is such a range of degrees that varies from the position of the cursor.
How can I implement it?
Answer 1, Authority 100%
There was the topic “Eyes, following the cursor”
Eyes that follow the cursor on JS
In fact, you need to do the same, only instead of changing the position of the eye to output an angle (which is also calculated)
i.e. The algorithm should be:
- define the center of the circle (define its borders and calculate the center)
- Define the position of the mouse cursor in the
- calculate the angle (it is better to use
asin
,acos
, and notatan
so as not to get division at some angles) - output the arrow position on the circle (using the rotation transformation style to the desired angle)
- output the value of the angle
window