android.view.animation.CycleInterpolator Java Examples
The following examples show how to use
android.view.animation.CycleInterpolator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnimUtils.java From PaymentKit-Droid with Apache License 2.0 | 6 votes |
/** * @param shouldResetTextColor if true make sure you end the previous animation before starting this one. */ public static ObjectAnimator getShakeAnimation(final TextView textView, final boolean shouldResetTextColor) { final int textColor = textView.getCurrentTextColor(); textView.setTextColor(Color.RED); ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(textView, "translationX", -16); shakeAnim.setDuration(SHAKE_DURATION); shakeAnim.setInterpolator(new CycleInterpolator(2.0f)); shakeAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator anim) { if (shouldResetTextColor) { textView.setTextColor(textColor); } } }); return shakeAnim; }
Example #2
Source File: PatterDrawActivity.java From Android with MIT License | 6 votes |
/** * According to the different status display text message * @param resId * @param isError */ private void showErrorHint(String resId,boolean isError){ if(resId == null){ drawpatterTv.setVisibility(View.INVISIBLE); }else{ drawpatterTv.setVisibility(View.VISIBLE); drawpatterTv.setText(resId); if(isError){ drawpatterTv.setTextColor(mActivity.getResources().getColor(R.color.color_ff6c5a)); Animation animationInto = AnimationUtils.loadAnimation(mActivity,R.anim.text_shake); animationInto.setInterpolator(new CycleInterpolator(5)); drawpatterTv.setAnimation(animationInto); }else{ drawpatterTv.setTextColor(mActivity.getResources().getColor(R.color.color_161A21)); } } }
Example #3
Source File: CreateChatFragment.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.brightRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #4
Source File: LaunchFragment.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #5
Source File: SetNumberActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(this, R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #6
Source File: ContactSelectActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.invalidRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.getBackground().setColorFilter((int) animation.getAnimatedValue(), PorterDuff.Mode.SRC_ATOP); editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(getActivity(), R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #7
Source File: ContactSelectActivity.java From weMessage with GNU Affero General Public License v3.0 | 6 votes |
private void invalidateField(final EditText editText){ ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.colorHeader), getResources().getColor(R.color.brightRed)); colorAnimation.setDuration(200); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { editText.setTextColor((int) animation.getAnimatedValue()); } }); Animation invalidShake = AnimationUtils.loadAnimation(this, R.anim.invalid_shake); invalidShake.setInterpolator(new CycleInterpolator(7F)); colorAnimation.start(); editText.startAnimation(invalidShake); }
Example #8
Source File: SegmentedButtonGroup.java From SegmentedButton with Apache License 2.0 | 6 votes |
private void initInterpolations() { ArrayList<Class> interpolatorList = new ArrayList<Class>() {{ add(FastOutSlowInInterpolator.class); add(BounceInterpolator.class); add(LinearInterpolator.class); add(DecelerateInterpolator.class); add(CycleInterpolator.class); add(AnticipateInterpolator.class); add(AccelerateDecelerateInterpolator.class); add(AccelerateInterpolator.class); add(AnticipateOvershootInterpolator.class); add(FastOutLinearInInterpolator.class); add(LinearOutSlowInInterpolator.class); add(OvershootInterpolator.class); }}; try { interpolatorSelector = (Interpolator) interpolatorList.get(animateSelector).newInstance(); } catch (Exception e) { e.printStackTrace(); } }
Example #9
Source File: MainActivity.java From CircularProgressDrawable with Apache License 2.0 | 6 votes |
/** * This animation will make a pulse effect to the inner circle * * @return Animation */ private Animator preparePulseAnimation() { AnimatorSet animation = new AnimatorSet(); Animator firstBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, drawable.getCircleScale(), 0.88f); firstBounce.setDuration(300); firstBounce.setInterpolator(new CycleInterpolator(1)); Animator secondBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0.75f, 0.83f); secondBounce.setDuration(300); secondBounce.setInterpolator(new CycleInterpolator(1)); Animator thirdBounce = ObjectAnimator.ofFloat(drawable, CircularProgressDrawable.CIRCLE_SCALE_PROPERTY, 0.75f, 0.80f); thirdBounce.setDuration(300); thirdBounce.setInterpolator(new CycleInterpolator(1)); animation.playSequentially(firstBounce, secondBounce, thirdBounce); return animation; }
Example #10
Source File: RadioRealButtonGroup.java From RadioRealButton with Apache License 2.0 | 5 votes |
private void initInterpolations() { Class[] interpolations = { FastOutSlowInInterpolator.class, BounceInterpolator.class, LinearInterpolator.class, DecelerateInterpolator.class, CycleInterpolator.class, AnticipateInterpolator.class, AccelerateDecelerateInterpolator.class, AccelerateInterpolator.class, AnticipateOvershootInterpolator.class, FastOutLinearInInterpolator.class, LinearOutSlowInInterpolator.class, OvershootInterpolator.class}; try { interpolatorText = (Interpolator) interpolations[animateTextsEnter].newInstance(); interpolatorDrawablesEnter = (Interpolator) interpolations[animateDrawablesEnter].newInstance(); interpolatorSelector = (Interpolator) interpolations[animateSelector].newInstance(); interpolatorTextExit = (Interpolator) interpolations[animateTextsExit].newInstance(); interpolatorDrawablesExit = (Interpolator) interpolations[animateDrawablesExit].newInstance(); } catch (Exception e) { e.printStackTrace(); } }
Example #11
Source File: EditTextShakeHelper.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
public EditTextShakeHelper(Context context) { // 初始化振动器 shakeVibrator = (Vibrator) context .getSystemService(Service.VIBRATOR_SERVICE); // 初始化震动动画 shakeAnimation = new TranslateAnimation(0, 10, 0, 0); shakeAnimation.setDuration(300); cycleInterpolator = new CycleInterpolator(8); shakeAnimation.setInterpolator(cycleInterpolator); }
Example #12
Source File: ViewAnimCreator.java From android-project-wo2b with Apache License 2.0 | 5 votes |
/** * 抖动动画 * * @param count 次数 * @return */ public static Animation shakeAnimation(int count) { Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(count)); translateAnimation.setDuration(600); return translateAnimation; }
Example #13
Source File: NavigationWelcomeActivity.java From GifAssistant with Apache License 2.0 | 5 votes |
private void doViewPagerAnimation4(int pagerIndex) { // 停掉页面3的动画及显示 mCurrentPager3Flag = false; if (mCloudTransAnimationX1.isRunning()) { mCloudTransAnimationX1.cancel(); mCloudTransAnimationY1.cancel(); mCloudTransAnimation2.cancel(); mCloudTransAnimation3.cancel(); mCloudTransAnimation4.cancel(); } mNav3CloudImageView1.setVisibility(View.INVISIBLE); mNav3CloudImageView2.setVisibility(View.INVISIBLE); mNav3CloudImageView3.setVisibility(View.INVISIBLE); mNav3CloudImageView4.setVisibility(View.INVISIBLE); mRocketAnimationDrawable.stop(); ObjectAnimator objAnim = ObjectAnimator.ofFloat(mNav4TopImageView, "rotation", 0f, 10f); CycleInterpolator interpolator = new CycleInterpolator(3.0f); objAnim.setStartDelay(500); objAnim.setDuration(3000); objAnim.setRepeatCount(Animation.INFINITE);// Animation.INFINITE objAnim.setRepeatMode(Animation.RESTART); objAnim.setInterpolator(interpolator); mNav4TopImageView.setPivotX(mNav4TopImageView.getWidth()*0.47f); mNav4TopImageView.setPivotY(mNav4TopImageView.getHeight()*0.05f); objAnim.start(); mNavTopStaticAnimationSet.setTarget(mNav4bottomTextImageView); mNavTopStaticAnimationSet.start(); }
Example #14
Source File: ClearEditText.java From SortedContactUI with Apache License 2.0 | 5 votes |
/** * 晃动动画 * @param counts 1秒钟晃动多少下 * @return */ public static Animation shakeAnimation(int counts){ Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(1000); return translateAnimation; }
Example #15
Source File: ZPositionAnimationDemoFragment.java From android-materialshadowninepatch with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { if (v == mCompatShadowItem) { ObjectAnimator animator = ObjectAnimator.ofFloat( mCompatShadowItemContainer, MaterialShadowContainerViewProperties.SHADOW_TRANSLATION_Z, mDisplayDensity * 0.0f, mDisplayDensity * 8.0f); animator.setDuration(500); animator.setInterpolator(new CycleInterpolator(0.5f)); animator.start(); } }
Example #16
Source File: ClearEditText.java From AndroidUI with MIT License | 5 votes |
/** * 晃动动画 * @param counts 0.5秒钟晃动多少下 * @return */ private Animation shakeAnimation(int counts){ Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(500); return translateAnimation; }
Example #17
Source File: ShakeHorizontal.java From FlycoDialog_Master with MIT License | 5 votes |
@Override public void setAnimation(View view) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10, 10); animator.setInterpolator(new CycleInterpolator(5)); animatorSet.playTogether(animator); /** * <pre> * 另一种shake实现 * ObjectAnimator.ofFloat(view, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0); * </pre> */ }
Example #18
Source File: EditTextShakeHelper.java From JianDanRxJava with Apache License 2.0 | 5 votes |
public EditTextShakeHelper(Context context) { // 初始化振动器 shakeVibrator = (Vibrator) context .getSystemService(Service.VIBRATOR_SERVICE); // 初始化震动动画 shakeAnimation = new TranslateAnimation(0, 10, 0, 0); shakeAnimation.setDuration(300); cycleInterpolator = new CycleInterpolator(8); shakeAnimation.setInterpolator(cycleInterpolator); }
Example #19
Source File: EditTextShakeHelper.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
public EditTextShakeHelper(Context context) { // 初始化振动器 shakeVibrator = (Vibrator) context .getSystemService(Service.VIBRATOR_SERVICE); // 初始化震动动画 shakeAnimation = new TranslateAnimation(0, 10, 0, 0); shakeAnimation.setDuration(300); cycleInterpolator = new CycleInterpolator(8); shakeAnimation.setInterpolator(cycleInterpolator); }
Example #20
Source File: CardNumHolder.java From PaymentKit-Droid with Apache License 2.0 | 5 votes |
public void indicateInvalidCardNum() { getCardField().setTextColor(Color.RED); mTopItem = mCardNumberEditText; ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(getCardField(), "translationX", -16); shakeAnim.setDuration(SHAKE_DURATION); shakeAnim.setInterpolator(new CycleInterpolator(2.0f)); shakeAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator anim) { mTopItem = null; } }); shakeAnim.start(); }
Example #21
Source File: EditTextShakeHelper.java From JianDan with Apache License 2.0 | 5 votes |
public EditTextShakeHelper(Context context) { // 初始化振动器 shakeVibrator = (Vibrator) context .getSystemService(Service.VIBRATOR_SERVICE); // 初始化震动动画 shakeAnimation = new TranslateAnimation(0, 10, 0, 0); shakeAnimation.setDuration(300); cycleInterpolator = new CycleInterpolator(8); shakeAnimation.setInterpolator(cycleInterpolator); }
Example #22
Source File: ClearCityEditText.java From MyHearts with Apache License 2.0 | 5 votes |
/** * 抖动动动画 * counts 1秒钟晃动多少下 */ public static Animation shakeAnimation(int counts){ Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(1000); return translateAnimation; }
Example #23
Source File: SwipeTodoView.java From ticdesign with Apache License 2.0 | 5 votes |
private void startRotationAnimation() { if (!mHasCenterIcon) { return; } mIconAnimator = ObjectAnimator.ofFloat(mCenterIv, "rotation", 0f, 15f); mIconAnimator.setRepeatCount(Animation.INFINITE); mIconAnimator.setInterpolator(new CycleInterpolator(1)); mIconAnimator.setDuration(2000); mIconAnimator.start(); }
Example #24
Source File: AnimationUtils.java From MaterialHome with Apache License 2.0 | 5 votes |
/** * 晃动动画 * * @param counts 1秒钟晃动多少下 * @return */ public static Animation shakeAnimation(int counts) { Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(1000); return translateAnimation; }
Example #25
Source File: SplashActivity.java From LittleFreshWeather with Apache License 2.0 | 5 votes |
private void startAnimation() { ObjectAnimator animator = ObjectAnimator.ofFloat(ivSplashIcon, "translationY", 0, -(ivSplashIcon.getHeight() >> 1)); animator.setDuration(800); animator.setRepeatCount(ObjectAnimator.INFINITE); animator.setRepeatMode(ObjectAnimator.RESTART); animator.setInterpolator(new CycleInterpolator(0.5f)); animator.start(); }
Example #26
Source File: ClearWriteEditText.java From sealtalk-android with MIT License | 5 votes |
/** * 晃动动画 * @param counts 半秒钟晃动多少下 * @return */ public static Animation shakeAnimation(int counts){ Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(500); return translateAnimation; }
Example #27
Source File: ClearEditText.java From Android-Application-ZJB with Apache License 2.0 | 5 votes |
/** * 晃动动画 * * @param counts 1秒钟晃动多少下 * @return */ public static Animation shakeAnimation(int counts) { Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(1000); return translateAnimation; }
Example #28
Source File: AlipayFailureView.java From AndroidAnimationExercise with Apache License 2.0 | 5 votes |
private void failureAnim() { float currentX = this.getTranslationX(); ObjectAnimator tansXAnim = ObjectAnimator.ofFloat(this, "translationX",currentX+20); tansXAnim.setDuration(1000); tansXAnim.setInterpolator(new CycleInterpolator(3)); tansXAnim.start(); }
Example #29
Source File: ShakeHorizontal.java From SprintNBA with Apache License 2.0 | 5 votes |
@Override public void setAnimation(View view) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10, 10); animator.setInterpolator(new CycleInterpolator(5)); animatorSet.playTogether(animator); /** * <pre> * 另一种shake实现 * ObjectAnimator.ofFloat(view, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0); * </pre> */ }
Example #30
Source File: KeyRect.java From android-passcodeview with Apache License 2.0 | 5 votes |
/** * Show animation indicated invalid pincode */ public void setError() { ValueAnimator goLeftAnimator = ValueAnimator.ofInt(0, 5); goLeftAnimator.setInterpolator(new CycleInterpolator(2)); goLeftAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { rect.left += (int) animation.getAnimatedValue(); rect.right += (int) animation.getAnimatedValue(); view.invalidate(); } }); goLeftAnimator.start(); }