ios - 使用 Titanium for iOS 为图像制作动画

标签 ios iphone animation titanium titanium-mobile

我有一个图像铃。我希望它是动画的,这样它就可以无限期地从右到左和从左到右。我尝试了以下编码,但无法实现:

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
};    

最佳答案

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

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

关于ios - 使用 Titanium for iOS 为图像制作动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27565291/

相关文章:

javascript - 动画和 DOM 重新排序后清除样式属性

animation - 在D3 js中将SVG坐标转换为页面坐标

ios - UIImage 到 NSData fatal error : unexpectedly found nil while unwrapping an Optional value

iPhone 核心数据 - 导入附加内容

iphone - 当 iPhone 中的 Appstore 上的应用程序版本更改时,sqlite 数据库更新

iPhone subview 在 2 个 View 之间翻转

iphone - JCrop 和 iPad/iPhone

android - java.lang.RuntimeException : Unknown animation name: objectAnimator

ios - 自定义类别下拉列表中未显示 EDStarRating?

ios - 类型名称的预期标识符