konstantinbueschel
4/6/2014 - 6:25 AM

Marquee type animation

Marquee type animation

/*
Hello, I have tested this issue in Ti SDK 3.3.0.RC. Its working good. 

Testing Environment:
 
    Titanium SDK: 3.3.0.RC, 3.2.3.GA
    Titanium CLI: 3.2.3
    IOS Simulator 7.1
    Appcelerator Studio, build: 3.3.0.201406271159
*/

var win = Titanium.UI.createWindow({
    title : 'Marquee',
    backgroundColor : '#fff'
});
 
var view = Ti.UI.createView({
    width : '100%',
});
var label = Titanium.UI.createLabel({
    left : 0,
    color : 'black',
    text : 'Marquee Testing'
});
var left = true;
var animation = Titanium.UI.createAnimation();
animation.duration = 1000;
animation.left = 0;
var animationHandler = function() {
    if (left) {
        animation.left = 190;
        left = false;
    } else {
        animation.left = 0;
        left = true;
    }
 
    label.animate(animation);
};
animation.addEventListener('complete', animationHandler);
label.animate(animation);
 
view.add(label);
win.add(view);
 
win.open();