0
我有以下幾點:旋轉圖像指向
CGPoint pos //center of an image
CGPoint target //a point, somewhere in the coordinate system
float rotation //the current rotation of the image to the x-axis, clockwise, so "right" would be 90°
現在我想要的形象繞它的中心點(POS),使其看起來直接朝TARGETPOINT。
我的想法是:計算對應於x軸的角度,減去旋轉,然後旋轉它。
兩件事:
1)我沒有計算角度。 (是的,我知道這一切都在拉德......)
2.)什麼是最好的旋轉?
- CGAffineTransform?但後來我需要一個imageView
- 或者:保存上下文,將原點設置爲圖像中心,旋轉上下文,繪製圖像,恢復上下文?更復雜,但沒有imageview需要...
是的,但我仍然必須計算角度.... – hutattedonmyarm
好吧,我做了那...你可以幫助我與CALayer的東西嗎?我有我的形象,需要旋轉x弧度.... – hutattedonmyarm