Skip to content

Instantly share code, notes, and snippets.

@Seasons7
Created September 24, 2011 10:05
Show Gist options
  • Save Seasons7/1239178 to your computer and use it in GitHub Desktop.
Save Seasons7/1239178 to your computer and use it in GitHub Desktop.
Shake animation that like editing of home screen.
function shakeAnimation(view) {
view.transform = Ti.UI.create2DMatrix().rotate(1);
var r1 = Ti.UI.create2DMatrix().rotate(2);
var r2 = Ti.UI.create2DMatrix().rotate(-2);
var anim1 = Ti.UI.createAnimation({
duration:200,
transform:r1,
});
var anim2 = Ti.UI.createAnimation({
duration:200,
transform:r2,
});
view.animate( anim2 );
anim2.addEventListener('complete',function(){
view.animate( anim1 );
});
anim1.addEventListener('complete',function(){
view.animate( anim2 );
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment