當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。