Back to project page oidarSample.
The source code is released under:
GNU General Public License
If you think the Android project oidarSample listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.oidar.animation; // www . j ava 2 s . c om import android.animation.Keyframe; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.view.View; import com.oidar.R; /** * Animator class based of https://plus.google.com/118417777153109946393/posts/FABaJhRMCuy */ public class CustomObjectAnimator { /** * Animate a shaking factor to indicate something is wrong. */ public static ObjectAnimator nope(View view) { int delta = view.getResources().getDimensionPixelOffset(R.dimen.spacing_medium); PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe(View.TRANSLATION_X, Keyframe.ofFloat(0f, 0), Keyframe.ofFloat(.10f, -delta), Keyframe.ofFloat(.26f, delta), Keyframe.ofFloat(.42f, -delta), Keyframe.ofFloat(.58f, delta), Keyframe.ofFloat(.74f, -delta), Keyframe.ofFloat(.90f, delta), Keyframe.ofFloat(1f, 0f) ); return ObjectAnimator.ofPropertyValuesHolder(view, pvhTranslateX). setDuration(500); } }