[Titanium]androidでviewを回転させる。

目的

viewを回転させてみます。

方法

completeイベントでループさせます。
変数の値でexitします。

var t = Ti.UI.create2DMatrix();
var spinf = Titanium.UI.createAnimation();
spinf.duration = 0;
spinf.addEventListener(‘complete’, function(e) {
if (sw_f_rotate == 1){
t = t.rotate(-3);
spinf.transform = t;
$.frontImage.animate(spinf);
}else{
exit;
}
});
//回転停止
sw_f_rotate = 0;
//回転開始
sw_f_rotate = 1;
$.frontImage.animate(spinf);

 

styleについて

<View id=”allView”>
<View id=”frontImage” />
<View id=”rearImage” />
</View>

コメント