2013-07-25 34 views
0

我正在開發鈦制輪轂。我需要將輪子從圖像的默認位置向下移動,然後將輪子旋轉到新的中心位置(向下移動後)。將輪子向下移動並在中心旋轉[Titanium]

我該怎麼做?

這是我寫的代碼;但是當我將它向下移動時,它不會旋轉新移動的中心。

var image = Titanium.UI.createImageView({ 
    backgroundImage:'test.png', 
    width: wheelWidth, 
    height:wheelHeight, 
    bottom:100 
    anchorPoint:{x:0.5, y:0.5} 
}); 
+0

上面編輯的文章 – user782400

回答

0

這將使圖像圍繞其中心旋轉10度。

var animation = Ti.UI.createAnimation({ 
    anchorPoint : {x:0.5, y:0.5}, // Put this in only if on Android 
    transform : Ti.UI.create2DMatrix().rotate(10), // amount of rotation 
    duration : 2000 // Time this will take in milliseconds 
}); 
image.animate(animation);