Skip to content

Instantly share code, notes, and snippets.

@wiledal
Created March 14, 2015 21:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wiledal/9705637fc44657ec97e7 to your computer and use it in GitHub Desktop.
Save wiledal/9705637fc44657ec97e7 to your computer and use it in GitHub Desktop.
Simple shake animation for TweenMax (gsap.js). For modern form error feedback.
function shakeAnimation(element){
TweenMax.to(element, .1, {
x: -7,
ease: Quad.easeInOut
});
TweenMax.to(element, .1, {
repeat: 4,
x: 7,
yoyo: true,
delay: .1,
ease: Quad.easeInOut
});
TweenMax.to(element, .1, {
x: 0,
delay: .1 * 4
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment