android.animation.IntEvaluator Java Examples

The following examples show how to use android.animation.IntEvaluator. 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: FillAnimation.java    From Android-Image-Slider with Apache License 2.0 6 votes vote down vote up
@NonNull
private PropertyValuesHolder createRadiusPropertyHolder(boolean isReverse) {
    String propertyName;
    int startRadiusValue;
    int endRadiusValue;

    if (isReverse) {
        propertyName = ANIMATION_RADIUS_REVERSE;
        startRadiusValue = radius / 2;
        endRadiusValue = radius;
    } else {
        propertyName = ANIMATION_RADIUS;
        startRadiusValue = radius;
        endRadiusValue = radius / 2;
    }

    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
Example #2
Source File: FillAnimation.java    From Android-Image-Slider with Apache License 2.0 6 votes vote down vote up
@NonNull
private PropertyValuesHolder createStrokePropertyHolder(boolean isReverse) {
    String propertyName;
    int startStrokeValue;
    int endStrokeValue;

    if (isReverse) {
        propertyName = ANIMATION_STROKE_REVERSE;
        startStrokeValue = radius;
        endStrokeValue = 0;
    } else {
        propertyName = ANIMATION_STROKE;
        startStrokeValue = 0;
        endStrokeValue = radius;
    }

    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startStrokeValue, endStrokeValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
Example #3
Source File: ScaleDownAnimation.java    From Android-Image-Slider with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
protected PropertyValuesHolder createScalePropertyHolder(boolean isReverse) {
	String propertyName;
	int startRadiusValue;
	int endRadiusValue;

	if (isReverse) {
		propertyName = ANIMATION_SCALE_REVERSE;
		startRadiusValue = (int) (radius * scaleFactor);
		endRadiusValue = radius;
	} else {
		propertyName = ANIMATION_SCALE;
		startRadiusValue = radius;
		endRadiusValue = (int) (radius * scaleFactor);
	}

	PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
	holder.setEvaluator(new IntEvaluator());

	return holder;
}
 
Example #4
Source File: ScaleAnimation.java    From Android-Image-Slider with Apache License 2.0 6 votes vote down vote up
@NonNull
protected PropertyValuesHolder createScalePropertyHolder(boolean isReverse) {
    String propertyName;
    int startRadiusValue;
    int endRadiusValue;

    if (isReverse) {
        propertyName = ANIMATION_SCALE_REVERSE;
        startRadiusValue = radius;
        endRadiusValue = (int) (radius * scaleFactor);
    } else {
        propertyName = ANIMATION_SCALE;
        startRadiusValue = (int) (radius * scaleFactor);
        endRadiusValue = radius;
    }

    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startRadiusValue, endRadiusValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
Example #5
Source File: BaseDialog.java    From Aria with Apache License 2.0 6 votes vote down vote up
/**
 * 进场动画
 */
private void in() {
  int height = AndroidUtils.getScreenParams(getContext())[1];
  ValueAnimator animator = ValueAnimator.ofObject(new IntEvaluator(), -height / 2, 0);
  animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override public void onAnimationUpdate(ValueAnimator animation) {
      mWpm.y = (int) animation.getAnimatedValue();
      mWindow.setAttributes(mWpm);
    }
  });
  animator.setInterpolator(new BounceInterpolator()); //弹跳
  Animator alpha = ObjectAnimator.ofFloat(mRootView, "alpha", 0f, 1f);
  AnimatorSet set = new AnimatorSet();
  set.play(animator).with(alpha);
  set.setDuration(2000).start();
}
 
Example #6
Source File: GestureView.java    From Jockey with Apache License 2.0 6 votes vote down vote up
/**
 * Animates the overlay to a specified radius, fades it out, and clears the current gesture
 * @param targetRadius The radius to animate the circular overlay to
 * @param time The time for this animation to last
 * @param alphaDelay An optional delay to add before animating the transparency of the overlay
 */
private void animateOutRadius(int targetRadius, int time, int alphaDelay) {
    ObjectAnimator alphaAnim = ObjectAnimator.ofObject(
            this, "overlayAlpha",
            new IntEvaluator(), mAlpha, 0);
    ObjectAnimator radiusAnim = ObjectAnimator.ofObject(
            this, "radius",
            new IntEvaluator(), (isRight() ? radius() : -radius()), targetRadius);

    radiusAnim
            .setDuration(time)
            .setInterpolator(AnimationUtils.loadInterpolator(getContext(),
                    android.R.interpolator.accelerate_quad));
    alphaAnim
            .setDuration(time)
            .setInterpolator(AnimationUtils.loadInterpolator(getContext(),
                    android.R.interpolator.accelerate_quad));

    radiusAnim.start();
    alphaAnim.setStartDelay(alphaDelay);
    alphaAnim.start();
}
 
Example #7
Source File: BottomFragment.java    From NewFastFrame with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateView() {
    intEvaluator = new IntEvaluator();
    floatEvaluator = new FloatEvaluator();
    int sameWidth = playOrPause.getLayoutParams().width;
    screenWidth = DensityUtil.getScreenWidth(getContext());
    screenHeight = DensityUtil.getScreenHeight(getContext());
    int margin = ((RelativeLayout.LayoutParams) playOrPause.getLayoutParams()).rightMargin;
    endPlay = screenWidth / 2 - (sameWidth * 2 + margin) + sameWidth / 2;
}
 
Example #8
Source File: DrawableAnimationBuilder.java    From scene with Apache License 2.0 4 votes vote down vote up
public DrawableAnimationBuilder alpha(int fromValue, int toValue) {
    hashMap.put(property, new Holder(new IntEvaluator(), fromValue, toValue));
    return this;
}
 
Example #9
Source File: ViewOtherAnimationBuilder.java    From scene with Apache License 2.0 4 votes vote down vote up
public T scrollX(int fromValue, int toValue) {
    hashMap.put(SCROLL_X, new Holder(new IntEvaluator(), fromValue, toValue));
    return (T) this;
}
 
Example #10
Source File: ViewOtherAnimationBuilder.java    From scene with Apache License 2.0 4 votes vote down vote up
public T scrollY(int fromValue, int toValue) {
    hashMap.put(SCROLL_Y, new Holder(new IntEvaluator(), fromValue, toValue));
    return (T) this;
}
 
Example #11
Source File: ImageViewAnimationBuilder.java    From scene with Apache License 2.0 4 votes vote down vote up
public ImageViewAnimationBuilder imageAlpha(int fromValue, int toValue) {
    hashMap.put(IMAGE_ALPHA, new Holder(new IntEvaluator(), fromValue, toValue));
    return this;
}
 
Example #12
Source File: SwapAnimation.java    From Android-Image-Slider with Apache License 2.0 4 votes vote down vote up
private PropertyValuesHolder createColorPropertyHolder(String propertyName, int startValue, int endValue) {
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(propertyName, startValue, endValue);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
Example #13
Source File: SlideAnimation.java    From Android-Image-Slider with Apache License 2.0 4 votes vote down vote up
private PropertyValuesHolder createSlidePropertyHolder() {
    PropertyValuesHolder holder = PropertyValuesHolder.ofInt(ANIMATION_COORDINATE, coordinateStart, coordinateEnd);
    holder.setEvaluator(new IntEvaluator());

    return holder;
}
 
Example #14
Source File: DimensionUpdateListener.java    From weex-uikit with MIT License 4 votes vote down vote up
DimensionUpdateListener(@NonNull View view) {
  this.view = view;
  intEvaluator = new IntEvaluator();
}