Skip to content

Instantly share code, notes, and snippets.

@kevinthecity
Created July 8, 2014 23:27
Show Gist options
  • Save kevinthecity/e3798b0cc1ac7895cd46 to your computer and use it in GitHub Desktop.
Save kevinthecity/e3798b0cc1ac7895cd46 to your computer and use it in GitHub Desktop.
/**
* Shake a view with a preset cycle interpolater
*
* @param view
* the view to shake
*/
public static void shakeIt(final View view) {
if (view != null) {
Animation shakeAnimation = new TranslateAnimation(0, 10, 0, 0);
shakeAnimation.setDuration(300);
shakeAnimation.setInterpolator(new CycleInterpolator(2));
view.startAnimation(shakeAnimation);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment