Android examples for Animation:Shake Animation
shake Instrument Animation
//package com.java2s; import android.view.animation.AnimationSet; import android.view.animation.RotateAnimation; public class Main { public static AnimationSet shakeInstrumentAnimation() { AnimationSet shake = new AnimationSet(false); RotateAnimation rotate1 = new RotateAnimation(0, 15, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); rotate1.setDuration(100);/*w ww .j a v a2 s . c o m*/ RotateAnimation rotate2 = new RotateAnimation(15, -15, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); rotate2.setDuration(200); RotateAnimation rotate3 = new RotateAnimation(-15, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); rotate3.setDuration(100); shake.addAnimation(rotate1); shake.addAnimation(rotate2); shake.addAnimation(rotate3); shake.setFillAfter(true); return shake; } }