Created
December 19, 2011 21:33
-
-
Save alanleard/1498983 to your computer and use it in GitHub Desktop.
Wobble
This file contains 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
var win = Ti.UI.createWindow(); | |
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 ); | |
}); | |
} | |
var view = Ti.UI.createView({ | |
backgroundColor:'blue', | |
height:57, | |
width:57, | |
borderRadius:5 | |
}); | |
win.add(view); | |
shakeAnimation(view); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment