當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueAnimator.setIntValues方法代碼示例

本文整理匯總了Java中android.animation.ValueAnimator.setIntValues方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueAnimator.setIntValues方法的具體用法?Java ValueAnimator.setIntValues怎麽用?Java ValueAnimator.setIntValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.setIntValues方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startAnim

import android.animation.ValueAnimator; //導入方法依賴的package包/類
/**
 * 給背景設置一個動畫
 *
 * @param endProgress 動畫的結束進度
 * @param endCallback 動畫結束時觸發
 */
private void startAnim(float endProgress, final Runnable endCallback) {
    // 獲取一個最終的顏色
    int finalColor = Resource.Color.WHITE; // UiCompat.getColor(getResources(), R.color.white);
    // 運算當前進度的顏色
    ArgbEvaluator evaluator = new ArgbEvaluator();
    int endColor = (int) evaluator.evaluate(endProgress, mBgDrawable.getColor(), finalColor);
    // 構建一個屬性動畫
    ValueAnimator valueAnimator = ObjectAnimator.ofObject(this, property, evaluator, endColor);
    valueAnimator.setDuration(1500); // 時間
    valueAnimator.setIntValues(mBgDrawable.getColor(), endColor); // 開始結束值
    valueAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            // 結束時觸發
            endCallback.run();
        }
    });
    valueAnimator.start();
}
 
開發者ID:FZZFVII,項目名稱:pipe,代碼行數:27,代碼來源:LaunchActivity.java

示例2: SLTouchListener

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public SLTouchListener(SphereLayout sphereLayout) {
    mSphereLayout = sphereLayout;
    mTouchSlop = ViewConfiguration.get(mSphereLayout.getContext()).getScaledTouchSlop();
    mInterpolator = new SpringInterpolator();
    mState = new RotateState();

    mRotateAnimator = new ValueAnimator();
    mRotateAnimator.setInterpolator(mInterpolator);
    mRotateAnimator.setIntValues(MAX_ROTATE_DEGREE, 0);
    mRotateAnimator.setDuration(DURATION);

    mRotateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mState.rotateDegree = (Integer) animation.getAnimatedValue();
            mSphereLayout.rotate(mState.direction, mState.rotateDegree);
        }
    });

    mFixAnimator = new ValueAnimator();
    mFixAnimator.setInterpolator(new DecelerateInterpolator());
}
 
開發者ID:thunderpunch,項目名稱:SphereLayout,代碼行數:23,代碼來源:SLTouchListener.java

示例3: createAppearBackgroundAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private Animator createAppearBackgroundAnimator() {
    int startColor = ResourcesCompat.getColor(getResources(),
            BACGROUND_TRANSPARENT_COLOR_RES,
            getContext().getTheme()
    );
    int finColor = ResourcesCompat.getColor(getResources(),
            BACKGROUND_COLOR_RES,
            getContext().getTheme()
    );
    ValueAnimator anim = new ValueAnimator();
    anim.setIntValues(startColor, finColor);
    anim.setEvaluator(ArgbEvaluator.getInstance());
    anim.setStartDelay(ANIMATION_DURATION / 2);
    anim.setDuration(ANIMATION_DURATION / 2);
    anim.addUpdateListener(animation -> {
        int color = (int) animation.getAnimatedValue();
        setBackgroundColor(color);
    });
    return anim;
}
 
開發者ID:roshakorost,項目名稱:Phial,代碼行數:21,代碼來源:ExpandedView.java

示例4: recolorBackground

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public static void recolorBackground(final View view,
                                     final int startColor,
                                     final int endColor,
                                     final int duration) {
    ValueAnimator anim = new ValueAnimator();
    anim.setIntValues(startColor, endColor);
    anim.setEvaluator(new ArgbEvaluator());
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            view.setBackgroundColor((Integer) animation.getAnimatedValue());
        }
    });
    anim.setDuration(duration);
    anim.start();
}
 
開發者ID:interactiveservices,項目名稱:utils-android,代碼行數:17,代碼來源:AnimUtils.java

示例5: LineFadeIndicator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public LineFadeIndicator(DachshundTabLayout dachshundTabLayout) {
    this.dachshundTabLayout = dachshundTabLayout;

    valueAnimator = new ValueAnimator();
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.setDuration(DEFAULT_DURATION);
    valueAnimator.addUpdateListener(this);
    valueAnimator.setIntValues(0,255);

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);

    rectF = new RectF();

    startXLeft = (int) dachshundTabLayout.getChildXLeft(dachshundTabLayout.getCurrentPosition());
    startXRight = (int) dachshundTabLayout.getChildXRight(dachshundTabLayout.getCurrentPosition());

    edgeRadius = -1;
}
 
開發者ID:Andy671,項目名稱:Dachshund-Tab-Layout,代碼行數:21,代碼來源:LineFadeIndicator.java

示例6: createValueAnimator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public static ValueAnimator createValueAnimator(AnimatedDrawable2 animatedDrawable) {
  int loopCount = animatedDrawable.getLoopCount();
  ValueAnimator animator = new ValueAnimator();
  animator.setIntValues(0, (int) animatedDrawable.getLoopDurationMs());
  animator.setDuration(animatedDrawable.getLoopDurationMs());
  animator.setRepeatCount(
      loopCount != AnimationInformation.LOOP_COUNT_INFINITE ? loopCount : ValueAnimator.INFINITE);
  animator.setRepeatMode(ValueAnimator.RESTART);
  // Use a linear interpolator
  animator.setInterpolator(null);
  ValueAnimator.AnimatorUpdateListener animatorUpdateListener =
      createAnimatorUpdateListener(animatedDrawable);
  animator.addUpdateListener(animatorUpdateListener);
  return animator;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:AnimatedDrawable2ValueAnimatorHelper.java

示例7: createColorAnimation

import android.animation.ValueAnimator; //導入方法依賴的package包/類
/**
 * this method replace for ValueAnimator.ofArgb() support below sdk 6.0
 *
 * @param values
 * @return
 */
private ValueAnimator createColorAnimation(int... values) {
    ValueAnimator colorAnimation = new ValueAnimator();
    colorAnimation.setIntValues(values);
    colorAnimation.setEvaluator(new ArgbEvaluator());
    colorAnimation.setDuration(ANIMATION_DURATION);
    return colorAnimation;
}
 
開發者ID:arjinmc,項目名稱:AndroidButtonLib,代碼行數:14,代碼來源:SubmitButton.java

示例8: animateColors

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void animateColors(int previousColor, int color) {
    ValueAnimator anim = new ValueAnimator();
    anim.setIntValues(previousColor, color);
    anim.setEvaluator(new ArgbEvaluator());
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
           setColors((Integer) valueAnimator.getAnimatedValue());
        }
    });

    anim.setDuration(150);
    anim.start();
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:15,代碼來源:BottomBarTab.java

示例9: showProgress

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public void showProgress(int duration) {
    if (isProgressShowing) {
        return;
    }
    isProgressShowing = true;
    status = Status.SHOWING;

    final int bw = button.getMeasuredWidth();
    buttonWidth = bw;
    buttonText = button.getText().toString();
    buttonBg = button.getBackground();

    button.setEnabled(false);
    button.setBackgroundResource(bgResId);
    final int pw = progress.getMeasuredWidth();
    ValueAnimator valueAnimator = new ValueAnimator();
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    valueAnimator.setDuration(duration);
    valueAnimator.setIntValues(bw, pw);
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            if (status != Status.SHOWING) {
                return;
            }

            int value = (int) animation.getAnimatedValue();
            button.getLayoutParams().width = value;
            button.requestLayout();
            if (value == pw) {
                progress.animate().alpha(1f).start();
                status = Status.SHOWED;
            }
        }
    });
    //button.setText(null);
    valueAnimator.start();
}
 
開發者ID:yanweiqiang,項目名稱:MyWidgetSample,代碼行數:39,代碼來源:ProgressButtonLayout.java

示例10: PointFadeIndicator

import android.animation.ValueAnimator; //導入方法依賴的package包/類
public PointFadeIndicator(DachshundTabLayout dachshundTabLayout) {
    this.dachshundTabLayout = dachshundTabLayout;

    valueAnimator = new ValueAnimator();
    valueAnimator.setInterpolator(new LinearInterpolator());
    valueAnimator.setDuration(DEFAULT_DURATION);
    valueAnimator.addUpdateListener(this);
    valueAnimator.setIntValues(0,255);

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);

    startX = (int) dachshundTabLayout.getChildXCenter(dachshundTabLayout.getCurrentPosition());
}
 
開發者ID:Andy671,項目名稱:Dachshund-Tab-Layout,代碼行數:16,代碼來源:PointFadeIndicator.java

示例11: initBlinkingAnimators

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void initBlinkingAnimators(final int index, ValueAnimator opacityAnimator) {
    opacityAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    opacityAnimator.setIntValues(mInitialOpacity, mTargetOpacity, mInitialOpacity);
    opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int opacity = (int) animation.getAnimatedValue();
            mAlphaOpacityList.set(index, opacity);
        }
    });
}
 
開發者ID:vulko,項目名稱:AnimatedArcProgressView,代碼行數:12,代碼來源:OpacityAnimation.java

示例12: initShinyAnimators

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void initShinyAnimators(final int index, ValueAnimator opacityAnimator) {
    opacityAnimator.setRepeatMode(ValueAnimator.REVERSE);
    final float opacityDecelerateFactor = 1.f + 0.8f * (index + 1);
    opacityAnimator.setInterpolator(new DecelerateInterpolator(opacityDecelerateFactor));
    opacityAnimator.setIntValues(255, 50, 255);
    opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int opacity = (int) animation.getAnimatedValue();
            mAlphaOpacityList.set(index, opacity);
        }
    });
}
 
開發者ID:vulko,項目名稱:AnimatedArcProgressView,代碼行數:14,代碼來源:OpacityAnimation.java

示例13: initAuraAnimators

import android.animation.ValueAnimator; //導入方法依賴的package包/類
private void initAuraAnimators(final int index, ValueAnimator opacityAnimator) {
    opacityAnimator.setRepeatMode(ValueAnimator.REVERSE);
    final float opacityDecelerateFactor = 1.f + 0.8f * (index + 1);
    opacityAnimator.setInterpolator(new AnticipateInterpolator(opacityDecelerateFactor));
    opacityAnimator.setIntValues(255, 50, 255, 50);
    opacityAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            final int opacity = (int) animation.getAnimatedValue();
            mAlphaOpacityList.set(index, opacity);
        }
    });
}
 
開發者ID:vulko,項目名稱:AnimatedArcProgressView,代碼行數:14,代碼來源:OpacityAnimation.java


注:本文中的android.animation.ValueAnimator.setIntValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。