Skip to content

Instantly share code, notes, and snippets.

@alanleard
Created December 19, 2011 22:02
Show Gist options
  • Save alanleard/1499104 to your computer and use it in GitHub Desktop.
Save alanleard/1499104 to your computer and use it in GitHub Desktop.
Simple Shake
var win = Ti.UI.createWindow();
function shakeAnimation(view, count, distance) {
var anim1 = Ti.UI.createAnimation({
duration:100,
left:view.left-distance,
autoreverse:true,
curve:Ti.UI.iOS.ANIMATION_CURVE_LINEAR,
repeat:count
});
view.animate( anim1 );
}
var view = Ti.UI.createView({
backgroundColor:'blue',
height:57,
width:57,
borderRadius:5,
borderColor:'white',
borderWidth:3,
left:132,
top:212
});
win.add(view);
shakeAnimation(view,5,10);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment