Skip to content

Instantly share code, notes, and snippets.

@simon-heinen
Last active September 25, 2023 17:13
Show Gist options
  • Star 40 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save simon-heinen/9795036 to your computer and use it in GitHub Desktop.
Save simon-heinen/9795036 to your computer and use it in GitHub Desktop.
A simple shake / wiggle animation for Android
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="70"
android:fromDegrees="-5"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="5"
android:repeatMode="reverse"
android:interpolator="@android:anim/linear_interpolator"
android:toDegrees="5" />
<translate
android:fromXDelta="-10"
android:toXDelta="10"
android:repeatCount="5"
android:repeatMode="reverse"
android:interpolator="@android:anim/linear_interpolator"
android:duration="70" />
</set>
@rio45ka
Copy link

rio45ka commented Nov 24, 2015

Awesome, thank you.

@alejofilaKoombea
Copy link

Great man

@ismdcf
Copy link

ismdcf commented Mar 17, 2016

Thanks pal, works like a charm

@Lalit-ETT
Copy link

Thank You simon-heinen

@andreynovikov
Copy link

Thank you!

@wackijaki
Copy link

coooooooooooool

@TiGarba
Copy link

TiGarba commented Mar 20, 2017

wow, thanks a lot!!!!

@parkjaewoo
Copy link

thank you!

@irfanirawansukirman
Copy link

How to use it?

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Jul 11, 2018

This starts from -10. Can I make it start from 0, to -10, to 10, etc... ?
Something like this:
https://user-images.githubusercontent.com/5357526/42556059-04e7cb40-84f3-11e8-872c-d071f264c8ba.gif

@leenabhandari
Copy link

leenabhandari commented Sep 11, 2018

How to use it?

Animation shake = AnimationUtils.loadAnimation(context, R.anim.shake);
view.startAnimation(shake);

@pchariskos
Copy link

Amazing. Thanks!

@AminMoradian
Copy link

thanks.

@Kernelzero
Copy link

cool~! appreciate u.

@markocdroid
Copy link

Thank You. I am just starting to learn android animations and this helps a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment