当前位置: 首页>>代码示例>>Java>>正文


Java ValueAnimator.getCurrentPlayTime方法代码示例

本文整理汇总了Java中android.animation.ValueAnimator.getCurrentPlayTime方法的典型用法代码示例。如果您正苦于以下问题:Java ValueAnimator.getCurrentPlayTime方法的具体用法?Java ValueAnimator.getCurrentPlayTime怎么用?Java ValueAnimator.getCurrentPlayTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.animation.ValueAnimator的用法示例。


在下文中一共展示了ValueAnimator.getCurrentPlayTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAnimatedFraction

import android.animation.ValueAnimator; //导入方法依赖的package包/类
static float getAnimatedFraction(ValueAnimator animator) {
  float fraction = animator.getDuration() > 0 ? ((float) animator.getCurrentPlayTime()) / animator.getDuration() : 0f;

  fraction = min(fraction, 1f);
  fraction = animator.getInterpolator().getInterpolation(fraction);
  return fraction;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:Utils.java

示例2: onAnimationUpdate

import android.animation.ValueAnimator; //导入方法依赖的package包/类
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    iconYPosition = ((int) animation.getAnimatedValue() - iconMargin);

    if (animation.getCurrentPlayTime() > animation.getDuration() / 2
            && !alphaEnterTrigger
            && actualState.equals(MaterialAnimatedSwitchState.RELEASE)) {
        exitAlphaAnimator.start();
        alphaEnterTrigger = true;
    }
}
 
开发者ID:tranleduy2000,项目名称:screenfilter,代码行数:12,代码来源:IconReleasePainter.java

示例3: onAnimationUpdate

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void onAnimationUpdate(final ValueAnimator animation) {
    final long currentTime = System.currentTimeMillis();
    if (mStartTime == -1) {
        mStartFrame = sGlobalFrameCounter;
        mStartTime = currentTime;
    }

    final long currentPlayTime = animation.getCurrentPlayTime();
    boolean isFinalFrame = Float.compare(1f, animation.getAnimatedFraction()) == 0;

    if (!mHandlingOnAnimationUpdate &&
        sVisible &&
        // If the current play time exceeds the duration, or the animated fraction is 1,
        // the animation will get finished, even if we call setCurrentPlayTime -- therefore
        // don't adjust the animation in that case
        currentPlayTime < animation.getDuration() && !isFinalFrame) {
        mHandlingOnAnimationUpdate = true;
        long frameNum = sGlobalFrameCounter - mStartFrame;
        // If we haven't drawn our first frame, reset the time to t = 0
        // (give up after MAX_DELAY ms of waiting though - might happen, for example, if we
        // are no longer in the foreground and no frames are being rendered ever)
        if (frameNum == 0 && currentTime < mStartTime + MAX_DELAY && currentPlayTime > 0) {
            // The first frame on animations doesn't always trigger an invalidate...
            // force an invalidate here to make sure the animation continues to advance
            mTarget.getRootView().invalidate();
            animation.setCurrentPlayTime(0);
        // For the second frame, if the first frame took more than 16ms,
        // adjust the start time and pretend it took only 16ms anyway. This
        // prevents a large jump in the animation due to an expensive first frame
        } else if (frameNum == 1 && currentTime < mStartTime + MAX_DELAY &&
                   !mAdjustedSecondFrameTime &&
                   currentTime > mStartTime + IDEAL_FRAME_DURATION &&
                   currentPlayTime > IDEAL_FRAME_DURATION) {
            animation.setCurrentPlayTime(IDEAL_FRAME_DURATION);
            mAdjustedSecondFrameTime = true;
        } else {
            if (frameNum > 1) {
                mTarget.post(new Runnable() {
                        public void run() {
                            animation.removeUpdateListener(FirstFrameAnimatorHelper.this);
                        }
                    });
            }
        }
        mHandlingOnAnimationUpdate = false;
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:48,代码来源:FirstFrameAnimatorHelper.java

示例4: updateInitAnimation

import android.animation.ValueAnimator; //导入方法依赖的package包/类
/**
 * Update animation initialization flag
 *
 * @param animation {@link ValueAnimator}
 */
private void updateInitAnimation(ValueAnimator animation) {
    if (mAnimateInitialMove && animation.getDuration() <= animation.getCurrentPlayTime()) {
        mIsInitialAnimationRunning = false;
    }
}
 
开发者ID:cheenid,项目名称:FLFloatingButton,代码行数:11,代码来源:FloatingView.java

示例5: onAnimationUpdate

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void onAnimationUpdate(final ValueAnimator animation) {
    final long currentTime = System.currentTimeMillis();
    if (mStartTime == -1) {
        mStartFrame = sGlobalFrameCounter;
        mStartTime = currentTime;
    }

    final long currentPlayTime = animation.getCurrentPlayTime();
    boolean isFinalFrame = Float.compare(1f, animation.getAnimatedFraction()) == 0;

    if (!mHandlingOnAnimationUpdate &&
        sVisible &&
        // If the current play time exceeds the duration, or the animated fraction is 1,
        // the animation will get finished, even if we call setCurrentPlayTime -- therefore
        // don't adjust the animation in that case
        currentPlayTime < animation.getDuration() && !isFinalFrame) {
        mHandlingOnAnimationUpdate = true;
        long frameNum = sGlobalFrameCounter - mStartFrame;
        // If we haven't drawn our first frame, reset the time to t = 0
        // (give up after MAX_DELAY ms of waiting though - might happen, for example, if we
        // are no longer in the foreground and no frames are being rendered ever)
        if (frameNum == 0 && currentTime < mStartTime + MAX_DELAY && currentPlayTime > 0) {
            // The first frame on animations doesn't always trigger an invalidate...
            // force an invalidate here to make sure the animation continues to advance
            mTarget.getRootView().invalidate();
            animation.setCurrentPlayTime(0);
        // For the second frame, if the first frame took more than 16ms,
        // adjust the start time and pretend it took only 16ms anyway. This
        // prevents a large jump in the animation due to an expensive first frame
        } else if (frameNum == 1 && currentTime < mStartTime + MAX_DELAY &&
                   !mAdjustedSecondFrameTime &&
                   currentTime > mStartTime + IDEAL_FRAME_DURATION &&
                   currentPlayTime > IDEAL_FRAME_DURATION) {
            animation.setCurrentPlayTime(IDEAL_FRAME_DURATION);
            mAdjustedSecondFrameTime = true;
        } else {
            if (frameNum > 1) {
                mTarget.post(new Runnable() {
                        public void run() {
                            animation.removeUpdateListener(FirstFrameAnimatorHelper.this);
                        }
                    });
            }
            if (DEBUG) print(animation);
        }
        mHandlingOnAnimationUpdate = false;
    } else {
        if (DEBUG) print(animation);
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:51,代码来源:FirstFrameAnimatorHelper.java

示例6: print

import android.animation.ValueAnimator; //导入方法依赖的package包/类
public void print(ValueAnimator animation) {
    float flatFraction = animation.getCurrentPlayTime() / (float) animation.getDuration();
    Log.d("FirstFrameAnimatorHelper", sGlobalFrameCounter +
          "(" + (sGlobalFrameCounter - mStartFrame) + ") " + mTarget + " dirty? " +
          mTarget.isDirty() + " " + flatFraction + " " + this + " " + animation);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:7,代码来源:FirstFrameAnimatorHelper.java


注:本文中的android.animation.ValueAnimator.getCurrentPlayTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。