Created
September 24, 2011 10:05
-
-
Save Seasons7/1239178 to your computer and use it in GitHub Desktop.
Shake animation that like editing of home screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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