如何根据触摸移动在圆周上保持切线的按钮?

How to move the button which stays on tangent around the circle based on touches?

我有一个圆,它的切线有一个按钮。 我想围绕圆圈移动那个按钮,它仍然会保持在它的切线上,只是角度会改变。 我可以通过改变角度来移动它,但是如何根据触摸到屏幕来移动它?

您可以找到相对于圆心的触摸点角度并使用它:

Angle = Math.atan2(touchpoint.y - circle.center.y, touchpoint.x - circle.center.x)