2013-07-25 36 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);