Rotate a div to certain height in js
问题 How to rotate a div to certain height suppose 10px. I can rotate a div otherwise around 360 degrees. I need the angle by which the div would touch the line. 回答1: You can apply the coordinate formula of the circle: (x - a)² + (y - b)² = r² . Because we've interest in the angle only, we can position the circle on the origin, and ignore a and b , which makes the calculation much more simple. In the image, the green items are known, the cyan items are helpers, and the red items are the changes