Created
December 19, 2011 22:02
-
-
Save alanleard/1499104 to your computer and use it in GitHub Desktop.
Simple Shake
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, 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