Skip to content

Instantly share code, notes, and snippets.

@exclusiveTanim
Last active November 13, 2016 21:50
Show Gist options
  • Save exclusiveTanim/10002213 to your computer and use it in GitHub Desktop.
Save exclusiveTanim/10002213 to your computer and use it in GitHub Desktop.
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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment