当前位置: 首页>>代码示例>>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;未经允许,请勿转载。