【问题标题】:Animating an image using Titanium for iOS使用 Titanium for iOS 为图像制作动画
【发布时间】:2014-12-19 11:36:35
【问题描述】:

我有一个图像铃。我希望它被动画化,使其无限期地从右到左和从左到右。我尝试使用以下编码,但无法实现:

var curWin = Ti.UI.createWindow;
var nButto = Ti.UI.createButton({
    backgroundImage : "/images/bell.png",
    height : 29,
    width : 29,
    top : 0,
    enabled : false,
    textAlign : Titanium.UI.TEXT_ALIGNMENT_RIGHT,
    font : {
        fontFamily : 'OpenSans-Regular',
        fontSize : 17
    }
});
curWin.add(nButto);
var matrix = Ti.UI.create2DMatrix();
matrix = matrix.rotate(90);
var a = Ti.UI.createAnimation({
    transform : matrix,
    duration : 500,
    autoreverse : true,
    repeat : 0,
    curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT ,
});


var matrix1 = Ti.UI.create2DMatrix();
matrix1 = matrix.rotate(180);
var a1 = Ti.UI.createAnimation({
    transform : matrix1,
    duration : 500,
    autoreverse : true,
    repeat : 0,
    curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT ,
});

nButto.animate(a);
nButto.animate(a1);

nButto.anchorPoint = {
    x : 0.5,
    y : 0.5
};    

【问题讨论】:

    标签: ios iphone animation titanium titanium-mobile


    【解决方案1】:

    你可以在两个动画中添加一个eventListener,在1的完整监听器中调用动画2,在2的监听器中调用动画1。

    a.addEventListener('complete',function(e){
      //your code for callback function here.
    });
    

    【讨论】:

      猜你喜欢
      • 2011-08-08
      • 2011-12-28
      • 1970-01-01
      • 1970-01-01
      • 2013-08-21
      • 1970-01-01
      • 2016-08-28
      • 1970-01-01
      • 2014-03-14
      相关资源
      最近更新 更多