当前位置: 首页>>代码示例>>Java>>正文


Java CycleInterpolator类代码示例

本文整理汇总了Java中android.view.animation.CycleInterpolator的典型用法代码示例。如果您正苦于以下问题:Java CycleInterpolator类的具体用法?Java CycleInterpolator怎么用?Java CycleInterpolator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CycleInterpolator类属于android.view.animation包,在下文中一共展示了CycleInterpolator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SquareKey

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
/**
 * Public constructor.
 *
 * @param pinView {@link PinView}
 * @param digit   title of the key. (-1 for the backspace key)
 * @param bounds  {@link Rect} bound.
 */
private SquareKey(@NonNull PinView pinView,
                  @NonNull String digit,
                  @NonNull Rect bounds,
                  @NonNull SquareKey.Builder builder) {
    super(pinView, digit, bounds, builder);

    mBounds = bounds;
    mBuilder = builder;

    //Error animator
    mErrorAnimator = ValueAnimator.ofInt(0, 10);
    mErrorAnimator.setInterpolator(new CycleInterpolator(2));
    mErrorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mBounds.left += (int) animation.getAnimatedValue();
            mBounds.right += (int) animation.getAnimatedValue();
            getPinView().invalidate();
        }
    });
}
 
开发者ID:kevalpatel2106,项目名称:PasscodeView,代码行数:29,代码来源:SquareKey.java

示例2: RectKey

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
/**
 * Public constructor.
 *
 * @param pinView {@link PinView}
 * @param digit   title of the key. (-1 for the backspace key)
 * @param bounds  {@link Rect} bound.
 */
private RectKey(@NonNull PinView pinView,
                @NonNull String digit,
                @NonNull Rect bounds,
                @NonNull RectKey.Builder builder) {
    super(pinView, digit, bounds, builder);

    mBounds = bounds;
    mBuilder = builder;

    //Error animator
    mErrorAnimator = ValueAnimator.ofInt(0, 10);
    mErrorAnimator.setInterpolator(new CycleInterpolator(2));
    mErrorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mBounds.left += (int) animation.getAnimatedValue();
            mBounds.right += (int) animation.getAnimatedValue();
            getPinView().invalidate();
        }
    });
}
 
开发者ID:kevalpatel2106,项目名称:PasscodeView,代码行数:29,代码来源:RectKey.java

示例3: initInterpolations

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
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();
    }
}
 
开发者ID:ceryle,项目名称:SegmentedButton,代码行数:23,代码来源:SegmentedButtonGroup.java

示例4: onAction

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
@OnClick(R.id.btn_start)
    public void onAction() {

//        float start = mView.getY();
//        if (start > 680f) {
//            start = 0f;
//            mView.setY(0f);
//        }

//        Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
//        Keyframe kf1 = Keyframe.ofFloat(.5f, 360f);
//        Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
//        PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("X", kf0, kf1, kf2);
//        ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(mView, pvh);
//
//        anim.setDuration(5000);
//        anim.setInterpolator(new AccelerateDecelerateInterpolator());
//        anim.start();

        ObjectAnimator animX = ObjectAnimator.ofFloat(mView, "x", 0, 50f);
        ObjectAnimator animY = ObjectAnimator.ofFloat(mView, "y", 0, 100f);
        AnimatorSet animSetXY = new AnimatorSet();
        animSetXY.playTogether(animX, animY);
        animSetXY.setInterpolator(new CycleInterpolator(0.5f));
        animSetXY.start();
    }
 
开发者ID:nanck,项目名称:AndroidAnimationDemo,代码行数:27,代码来源:FrameFragment.java

示例5: initAnimation

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
private void initAnimation(){
	pushLeftIn = new TranslateAnimation(
            TranslateAnimation.RELATIVE_TO_SELF, 1.0f,   
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
	pushLeftIn.setDuration(200);
	pushLeftIn.setFillAfter(true);
	
	pushLeftOut = new TranslateAnimation(
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,   
            TranslateAnimation.RELATIVE_TO_SELF, -1.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
	pushLeftOut.setDuration(200);
	pushLeftOut.setFillAfter(true);
	
	shakeAni = new TranslateAnimation(
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,   
            TranslateAnimation.RELATIVE_TO_SELF, 0.05f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f,
            TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
	shakeAni.setDuration(300);
	shakeAni.setInterpolator(new CycleInterpolator(2.0f));
}
 
开发者ID:yongbeam,项目名称:DiaryMemo,代码行数:26,代码来源:Password.java

示例6: run

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
@Override
public void run() {

    if (mView != null && mView.getWidth() != 0 && mView.getHeight() != 0) {

        if (bounceViewAnimation != null && !bounceViewAnimation.hasEnded()) {
            return;
        }

        bounceViewAnimation = new ScaleAnimation(1f, mRatio, 1f, mRatio, mView.getWidth() / 2, mView.getHeight() / 2);

        // Define the parameters of the animation
        bounceViewAnimation.setDuration(mTime);
        bounceViewAnimation.setInterpolator(new CycleInterpolator(0.5f));
        mView.setVisibility(View.VISIBLE);
        mView.startAnimation(bounceViewAnimation);
    }

    if (mInfiniteBounce) {
        bounceViewHandler.postDelayed(bounceViewRunnable, 2000);
    }
}
 
开发者ID:CmoaToto,项目名称:CmoaQuiz,代码行数:23,代码来源:ViewBouncer.java

示例7: shakeView

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
/**
    * To shake a view
    * @param view
    */
protected void shakeView(View view){
	float delta = 10.0f;
	CycleInterpolator cycle = new CycleInterpolator(6);
	AnimationSet animSet = new AnimationSet(false);
	
	Animation anim = new TranslateAnimation(0, delta, 0, 0);
	anim.setDuration(500);
	anim.setInterpolator(cycle);
	animSet.addAnimation(anim);
	view.startAnimation(animSet);
	
	try{
		Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
		vibrator.vibrate(300);
	}catch(Exception e){}
	
}
 
开发者ID:DanielShum,项目名称:MaterialAppBase,代码行数:22,代码来源:BaseFragmentActivity.java

示例8: shake

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
public static void shake(View view, Option option) {

		if (option == null) {
			option = getOption(view.getContext());
		}

		TranslateAnimation ta = new TranslateAnimation(-option.mOffsetX,
				option.mOffsetX, -option.mOffsetY, option.mOffsetY);
		ta.setDuration(option.mDuration);
		ta.setInterpolator(new CycleInterpolator(option.mRepeatCount));

		view.startAnimation(ta);

		if (option.mVibrate) {
			Vibrator v = (Vibrator) view.getContext().getSystemService(
					Context.VIBRATOR_SERVICE);
			v.vibrate(getVibratePattern(option), -1);
		}
	}
 
开发者ID:baoyongzhang,项目名称:WindowShaker,代码行数:20,代码来源:WindowShaker.java

示例9: preparePulseAnimation

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Sefford,项目名称:CircularProgressDrawable,代码行数:25,代码来源:MainActivity.java

示例10: setHinted

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
void setHinted(boolean hinted) {
  if (mHinted != hinted) {
    mHinted = hinted;
    regenerateCachedDrawable();
    if (hinted) {
      // Throb animation
      Animation throbAnimation =
          new ScaleAnimation(1.0f, 1.15f, 1.0f, 1.15f, mBounds.centerX(), mBounds.centerY());
      throbAnimation.setInterpolator(new CycleInterpolator(0.5f));
      throbAnimation.setDuration(HINT_ANIMATION_DURATION_MS);
      throbAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
      throbAnimation.setAnimationListener(new BaseAnimationListener());
      updateAnimation(throbAnimation);
    }
  }
}
 
开发者ID:amorris13,项目名称:triples,代码行数:17,代码来源:CardDrawable.java

示例11: onIncorrectTriple

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
void onIncorrectTriple() {
  mSelected = false;
  mShakeAnimating = true;
  // Shake animation
  Animation shakeAnimation = new RotateAnimation(0, 5, mBounds.centerX(), mBounds.centerY());
  shakeAnimation.setInterpolator(new CycleInterpolator(4));
  shakeAnimation.setDuration(INCORRECT_ANIMATION_DURATION_MS);
  shakeAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
  shakeAnimation.setAnimationListener(
      new BaseAnimationListener() {
        @Override
        public void onAnimationEnd(Animation animation) {
          super.onAnimationEnd(animation);
          mShakeAnimating = false;
          regenerateCachedDrawable();
        }
      });
  updateAnimation(shakeAnimation);
}
 
开发者ID:amorris13,项目名称:triples,代码行数:20,代码来源:CardDrawable.java

示例12: getShakeAnimation

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
/**
 * @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;
}
 
开发者ID:brendanw,项目名称:PaymentKit-Droid,代码行数:21,代码来源:AnimUtils.java

示例13: initShowAnimation

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
@Override
protected Animation initShowAnimation() {
    AnimationSet set=new AnimationSet(false);
    Animation shakeAnima=new RotateAnimation(0,15,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    shakeAnima.setInterpolator(new CycleInterpolator(5));
    shakeAnima.setDuration(400);
    set.addAnimation(getDefaultAlphaAnimation());
    set.addAnimation(shakeAnima);
    return set;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DialogPopup.java

示例14: parse

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
public static Interpolator parse(Integer type, Float cycles) {
        if (type != null) {
            switch (type) {
                case 0:
                    return new AccelerateDecelerateInterpolator();
                case 1:
                    return new AccelerateInterpolator();
                case 2:
                    return new AnticipateInterpolator();
                case 3:
                    return new AnticipateOvershootInterpolator();
                case 4:
                    return new BounceInterpolator();
                case 5:
                    return new CycleInterpolator((cycles != null && cycles > 0) ? cycles : 1f);
                case 6:
                    return new DecelerateInterpolator();
                case 7:
                    return new LinearInterpolator();
                case 8:
                    return new OvershootInterpolator();
                //暂时不支持的
//            case 7: return new FastOutLinearInterplator();
//            case 8: return new FastOutSlowInInterplator();
//            case 10: return new LinearOutSlowInInterplator();
//            case 12: return new PathInterplator();
                default:
                    return new LinearInterpolator();
            }
        } else {
            return new LinearInterpolator();
        }
    }
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:34,代码来源:UDInterpolator.java

示例15: shakeAnimation

import android.view.animation.CycleInterpolator; //导入依赖的package包/类
/**
 * 晃动动画
 *
 * @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;
}
 
开发者ID:jianjun0425,项目名称:MultiFuncViewLibrary,代码行数:13,代码来源:MultiFuncEditText.java


注:本文中的android.view.animation.CycleInterpolator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。