我正在創建應該在屏幕上移動的動畫球。我想讓它朝着屏幕的中心移動,就好像它被中心所吸引。我怎樣才能做到這一點?Xcode,iphone - 使圖像動畫在特定方向移動
2
A
回答
2
你可以試試這個代碼
[UIView beginAnimations:nil context:NULL]; //starting Animation
[UIView setAnimationDuration:1.0];
[UIView setAnimationRepeatCount:10];
[UIView setAnimationRrepeatAutoreverses:YES];
CGPoint position = 200.0f;
position.y = 200.0f;
position.x = 150.0f;
img.center = position;
[UIView commitAnimations];
如果是cocos2d的,您可以使用Move方法,
id move = [CCMoveTo actionWithDuration:3 position:ccp(160,240);
[sprite runAction:move];
+0
ü`CGPoint位置= 200.0f;`ISN沒錯,對吧?另外,你不需要`CGPointMake(160.0f,240.0f)`作爲中心嗎? – 2011-04-15 17:58:47
1
image.center = CGPointMake(image.center.x + 10, image.center.y);
相關問題
- 1. Iphone以特定速度在特定方向上移動
- 2. 翻轉圖像/動畫,使其跟隨移動方向
- 3. iPhone視圖移動動畫
- 4. 圖像與動畫在iphone
- 5. JavaFX移動圖像動畫
- 6. 2D在特定方向上的移動
- 7. 使用CSS3動畫移動圖像
- 8. 向其方向移動圖像?
- 9. xcode iphone球動畫
- 10. 動畫圖像像它從右向左移動
- 11. 在畫布上繪圖以編程方式使圖像移動
- 12. 移動畫廊圖像
- 13. ios:基於方向的移動圖像
- 14. 在xcode中移動多個圖像
- 15. Angualr 2動畫:移動圖像流暢
- 16. 基本核心動畫 - 移動圖像
- 17. Android圖像移動動畫問題
- 18. 動畫或從右向左移動圖像
- 19. CADisplayLink問題動畫iphone xcode
- 20. IOS中的自動圖像方向
- 21. 在Word2Vec中沿特定方向移動向量空間
- 22. 在Android上使用翻譯動畫移動圖像的問題
- 23. 如何在RubyMotion中使圖像移動/動畫?
- 24. Android Java使圖像向下移動
- 25. 動畫圖像向左像幻燈片
- 26. 如何使用xcode動畫動態圖像數組?
- 27. iPhone的圖像方向 - 自動旋轉圖像與PHP,PEL,Image_moo
- 28. Xcode 6爲iPhone 6啓動圖像加
- 29. Android:動畫圖像?
- 30. css3/jquery動畫/轉換/:如何使圖像垂直向後移動?
使用cocos2d的 – Anish 2011-04-15 16:58:34