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


Java ObjectAnimator.addUpdateListener方法代碼示例

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


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

示例1: spin

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * Applys a spin animation to the Chart.
 *
 * @param durationmillis
 * @param fromangle
 * @param toangle
 */
@SuppressLint("NewApi")
public void spin(int durationmillis, float fromangle, float toangle, Easing.EasingOption easing) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    setRotationAngle(fromangle);

    ObjectAnimator spinAnimator = ObjectAnimator.ofFloat(this, "rotationAngle", fromangle,
            toangle);
    spinAnimator.setDuration(durationmillis);
    spinAnimator.setInterpolator(Easing.getEasingFunctionFromOption(easing));

    spinAnimator.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            postInvalidate();
        }
    });
    spinAnimator.start();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:30,代碼來源:PieRadarChartBase.java

示例2: startScaleAnimation

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void startScaleAnimation() {
    ObjectAnimator animator=ObjectAnimator.ofFloat(this,"xxx",0,1).setDuration(300);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float progress= (float) animation.getAnimatedValue();
            //當progress<0.5f就放大,否則縮小
            if(progress<0.5f){
                setScaleX(1+progress*THRESHOLD*2);
                setScaleY(1+progress*THRESHOLD*2);
            }else{
                setScaleX(1+THRESHOLD-(progress-0.5f)*2*THRESHOLD);
                setScaleY(1+THRESHOLD-(progress-0.5f)*2*THRESHOLD);
            }
        }
    });

    animator.start();


}
 
開發者ID:RealMoMo,項目名稱:72GGames_Demo,代碼行數:22,代碼來源:HomeChannelView.java

示例3: unselectMenu

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public void unselectMenu(){
    tvMenu.setVisibility(VISIBLE);
    ivIcon.setImageResource(normalIconId);
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(null,"xxx",1,0).setDuration(300);
    objectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float progress = (float) animation.getAnimatedValue();
            setPivotX(getWidth()/2);
            setPivotY(0);
            setScaleX(1+progress*THRESHOLD);
            setScaleY(1+progress*THRESHOLD);
        }
    });

    objectAnimator.start();
}
 
開發者ID:RealMoMo,項目名稱:72GGames_Demo,代碼行數:18,代碼來源:BottomMenu.java

示例4: selectMenu

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public void selectMenu(){
    tvMenu.setVisibility(INVISIBLE);
    ivIcon.setImageResource(selectIconId);
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(null,"xxx",0,1).setDuration(300);
    objectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float progress = (float) animation.getAnimatedValue();
            setPivotX(getWidth()/2);
            setPivotY(0);
            setScaleX(1+progress*THRESHOLD);
            setScaleY(1+progress*THRESHOLD);
        }
    });

    objectAnimator.start();

}
 
開發者ID:RealMoMo,項目名稱:72GGames_Demo,代碼行數:19,代碼來源:BottomMenu.java

示例5: smoothScrollTo

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void smoothScrollTo(int desX, int desY, AnimatorListener listener)
{
    ObjectAnimator xTranslate = ObjectAnimator.ofInt(this, "scrollX", desX);
    ObjectAnimator yTranslate = ObjectAnimator.ofInt(this, "scrollY", desY);

    yTranslate.addUpdateListener(new AnimatorUpdateListener()
    {
        @Override
        public void onAnimationUpdate(ValueAnimator animation)
        {
            if (mHeaderStatusChangedListener != null) mHeaderStatusChangedListener.onHeaderOffsetChanged((int) (mScrollOffsetHeight * animation.getAnimatedFraction()), animation.getAnimatedFraction());
        }
    });

    AnimatorSet animators = new AnimatorSet();
    animators.setDuration(240L);
    animators.playTogether(xTranslate, yTranslate);
    if (listener != null) animators.addListener(listener);
    animators.start();
}
 
開發者ID:kfrozen,項目名稱:HeaderCollapsibleLayout,代碼行數:21,代碼來源:HeaderCollapsibleLayout.java

示例6: startSaturationAnimation

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void startSaturationAnimation(Context context, final AppCompatImageView target) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        target.setHasTransientState(true);
        final AnimUtils.ObservableColorMatrix matrix = new AnimUtils.ObservableColorMatrix();
        final ObjectAnimator saturation = ObjectAnimator.ofFloat(
                matrix, AnimUtils.ObservableColorMatrix.SATURATION, 0f, 1f);
        saturation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                target.setColorFilter(new ColorMatrixColorFilter(matrix));
            }
        });
        saturation.setDuration(2000);
        saturation.setInterpolator(AnimUtils.getFastOutSlowInInterpolator(context));
        saturation.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                target.clearColorFilter();
                target.setHasTransientState(false);
            }
        });
        saturation.start();
    }
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:25,代碼來源:CollectionAdapter.java

示例7: getDisappearAnimator

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
@SuppressLint("ObjectAnimatorBinding")
public ObjectAnimator getDisappearAnimator() {
    if (!mIsInitialized || !mDrawValuesReady) {
        Log.e(TAG, "RadialSelectorView was not ready for animation.");
        return null;
    }

    Keyframe kf0, kf1, kf2;
    float midwayPoint = 0.2f;
    int duration = 500;

    kf0 = Keyframe.ofFloat(0f, 1);
    kf1 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
    kf2 = Keyframe.ofFloat(1f, mTransitionEndRadiusMultiplier);
    PropertyValuesHolder radiusDisappear = PropertyValuesHolder.ofKeyframe(
            "animationRadiusMultiplier", kf0, kf1, kf2);

    kf0 = Keyframe.ofFloat(0f, 1f);
    kf1 = Keyframe.ofFloat(1f, 0f);
    @SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder fadeOut = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1);

    ObjectAnimator disappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
            this, radiusDisappear, fadeOut).setDuration(duration);
    disappearAnimator.addUpdateListener(mInvalidateUpdateListener);

    return disappearAnimator;
}
 
開發者ID:ttpho,項目名稱:TimePicker,代碼行數:28,代碼來源:RadialSelectorView.java

示例8: getReappearAnimator

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public ObjectAnimator getReappearAnimator() {
    if (!mIsInitialized || !mDrawValuesReady) {
        Log.e(TAG, "RadialSelectorView was not ready for animation.");
        return null;
    }

    Keyframe kf0, kf1, kf2, kf3;
    float midwayPoint = 0.2f;
    int duration = 500;

    // The time points are half of what they would normally be, because this animation is
    // staggered against the disappear so they happen seamlessly. The reappear starts
    // halfway into the disappear.
    float delayMultiplier = 0.25f;
    float transitionDurationMultiplier = 1f;
    float totalDurationMultiplier = transitionDurationMultiplier + delayMultiplier;
    int totalDuration = (int) (duration * totalDurationMultiplier);
    float delayPoint = (delayMultiplier * duration) / totalDuration;
    midwayPoint = 1 - (midwayPoint * (1 - delayPoint));

    kf0 = Keyframe.ofFloat(0f, mTransitionEndRadiusMultiplier);
    kf1 = Keyframe.ofFloat(delayPoint, mTransitionEndRadiusMultiplier);
    kf2 = Keyframe.ofFloat(midwayPoint, mTransitionMidRadiusMultiplier);
    kf3 = Keyframe.ofFloat(1f, 1);
    PropertyValuesHolder radiusReappear = PropertyValuesHolder.ofKeyframe(
            "animationRadiusMultiplier", kf0, kf1, kf2, kf3);

    kf0 = Keyframe.ofFloat(0f, 0f);
    kf1 = Keyframe.ofFloat(delayPoint, 0f);
    kf2 = Keyframe.ofFloat(1f, 1f);
    @SuppressLint("ObjectAnimatorBinding") PropertyValuesHolder fadeIn = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2);

    ObjectAnimator reappearAnimator = ObjectAnimator.ofPropertyValuesHolder(
            this, radiusReappear, fadeIn).setDuration(totalDuration);
    reappearAnimator.addUpdateListener(mInvalidateUpdateListener);
    return reappearAnimator;
}
 
開發者ID:ttpho,項目名稱:TimePicker,代碼行數:38,代碼來源:RadialSelectorView.java

示例9: animateX

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * Animates the rendering of the chart on the x-axis with the specified
 * animation time. If animate(...) is called, no further calling of
 * invalidate() is necessary to refresh the chart.
 *
 * @param durationMillis
 * @param easing
 */
public void animateX(int durationMillis, EasingFunction easing) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    ObjectAnimator animatorX = ObjectAnimator.ofFloat(this, "phaseX", 0f, 1f);
    animatorX.setInterpolator(easing);
    animatorX.setDuration(durationMillis);
    animatorX.addUpdateListener(mListener);
    animatorX.start();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:ChartAnimator.java

示例10: animateY

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * Animates the rendering of the chart on the y-axis with the specified
 * animation time. If animate(...) is called, no further calling of
 * invalidate() is necessary to refresh the chart.
 *
 * @param durationMillis
 * @param easing
 */
public void animateY(int durationMillis, EasingFunction easing) {

    if (android.os.Build.VERSION.SDK_INT < 11)
        return;

    ObjectAnimator animatorY = ObjectAnimator.ofFloat(this, "phaseY", 0f, 1f);
    animatorY.setInterpolator(easing);
    animatorY.setDuration(durationMillis);
    animatorY.addUpdateListener(mListener);
    animatorY.start();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:ChartAnimator.java

示例11: animateHeartButton

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void animateHeartButton(final RecipesAdapter.RecipeViewHolder holder) {
    AnimatorSet animatorSet = new AnimatorSet();

    ObjectAnimator rotation = ObjectAnimator.ofFloat(holder.likeButton, "rotation", 0.0f, 360.0f);
    rotation.setDuration(800);
    rotation.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(holder.likeButton, "scaleX", 1.0f, 1.5f, 1.0f);
    scaleX.setDuration(800);
    scaleX.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(holder.likeButton, "scaleY", 1.0f, 1.5f, 1.0f);
    scaleY.setDuration(800);
    scaleY.setInterpolator(ANTICIPATE_OVERSHOOT_INTERPOLATOR);

    rotation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            if (valueAnimator.getCurrentPlayTime() >= 500) {
                holder.likeButton.setImageResource(R.drawable.ic_favorite_higlighted_24dp);
            }
        }
    });

    animatorSet.playTogether(rotation, scaleX, scaleY);

    animatorSet.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animator) {
            dispatchAnimationFinished(holder);
        }

    });

    animatorSet.start();

}
 
開發者ID:vicky7230,項目名稱:Paprika,代碼行數:36,代碼來源:RecipesItemAnimator.java

示例12: prepareStateChange

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
@Override
public void prepareStateChange(State toState, AnimatorSet targetAnim) {
    int finalAlpha = getAlphaForState(toState);
    if (targetAnim == null) {
        mBgPaint.setAlpha(finalAlpha);
        invalidate();
    } else {
        ObjectAnimator anim = ObjectAnimator.ofArgb(mBgPaint, "alpha", finalAlpha);
        anim.addUpdateListener(new AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                invalidate();
            }
        });
        targetAnim.play(anim);
    }
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:18,代碼來源:QsbBlockerView.java

示例13: leftchange

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public void leftchange(View view) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(mColorTextView,"progress",0,1);
    animator.setDuration(2000).start();
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            float value = (float) animation.getAnimatedValue();
            mColorTextView.setprogress(value,ColorTextView.DEC_LEFT);
        }
    });


}
 
開發者ID:LillteZheng,項目名稱:ViewPagerHelper,代碼行數:14,代碼來源:MainActivity.java

示例14: getViewTranslationAnimator

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private Animator getViewTranslationAnimator(View v, float target,
        AnimatorUpdateListener listener) {
    ObjectAnimator anim = createTranslationAnimation(v, target);
    if (listener != null) {
        anim.addUpdateListener(listener);
    }
    return anim;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:9,代碼來源:SwipeHelper.java

示例15: addOnUpdateListener

import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void addOnUpdateListener(ObjectAnimator animator) {
    if (animator != null && mOnUpdateCallback != null) {
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                LuaUtil.callFunction(mOnUpdateCallback);
            }
        });
    }
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:11,代碼來源:UDAnimator.java


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