类android.graphics.Interpolator源码实例Demo

下面列出了怎么用android.graphics.Interpolator的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FirefoxReality   文件: CustomScrollView.java
public void run() {
    long now = AnimationUtils.currentAnimationTimeMillis();
    if (now >= mFadeStartTime) {
        int nextFrame = (int) now;
        int framesCount = 0;

        Interpolator interpolator = mScrollBarInterpolator;
        interpolator.setKeyFrame(framesCount++, nextFrame, OPAQUE);

        nextFrame += mScrollBarFadeDuration;
        interpolator.setKeyFrame(framesCount, nextFrame, TRANSPARENT);

        mState = ScrollAnimatorState.FADING;

        mHost.invalidate();
    }
}
 
源代码2 项目: OmniList   文件: FastScrollDelegate.java
public void run() {
	long now = AnimationUtils.currentAnimationTimeMillis();
	if (now >= fadeStartTime) {

		// the animation fades the scrollbars out by changing
		// the opacity (alpha) from fully opaque to fully
		// transparent
		int nextFrame = (int) now;
		int framesCount = 0;

		Interpolator interpolator = scrollBarInterpolator;

		// Start opaque
		interpolator.setKeyFrame(framesCount++, nextFrame, OPAQUE);

		// End transparent
		nextFrame += scrollBarFadeDuration;
		interpolator.setKeyFrame(framesCount, nextFrame, TRANSPARENT);

		state = FADING;

		// Kick off the fade animation
		// host.invalidate(true);
		host.invalidate();
	}
}
 
源代码3 项目: FirefoxReality   文件: CustomScrollView.java
private void drawScrollBars(Canvas canvas) {
    boolean invalidate = false;
    if (mIsHandlingTouchEvent) {
        mThumbDrawable.setAlpha(255);

    } else {
        if (!mIsAlwaysVisible) {
            final ScrollAnimator cache = mScrollCache;
            final ScrollAnimatorState state = cache.mState;
            if (state == ScrollAnimatorState.OFF) {
                return;
            }
            if (state == ScrollAnimatorState.FADING) {
                if (cache.mInterpolatorValues == null) {
                    cache.mInterpolatorValues = new float[1];
                }
                float[] values = cache.mInterpolatorValues;
                if (cache.mScrollBarInterpolator.timeToValues(values) == Interpolator.Result.FREEZE_END) {
                    cache.mState = ScrollAnimatorState.OFF;
                } else {
                    mThumbDrawable.setAlpha(Math.round(values[0]));
                }
                invalidate = true;

            } else {
                mThumbDrawable.setAlpha(255);
            }
        }
    }

    if (updateThumbRect(0)) {
        final int scrollY = getScrollY();
        final int scrollX = getScrollX();
        mThumbDrawable.setBounds(mThumbRect.left + scrollX, mThumbRect.top + scrollY, mThumbRect.right + scrollX,
                mThumbRect.bottom + scrollY);
        mThumbDrawable.draw(canvas);
    }
    if (invalidate) {
        invalidate();
    }
}
 
源代码4 项目: OmniList   文件: FastScrollDelegate.java
private void onDrawScrollBars(Canvas canvas) {
	boolean invalidate = false;
	if (mIsHanlingTouchEvent) {
		mThumbDrawable.setAlpha(255);
	} else {
		// Copy from View.class
		final ScrollabilityCache cache = mScrollCache;
		// cache.scrollBar = mThumbDrawable;
		final int state = cache.state;
		if (state == ScrollabilityCache.OFF) {
			return;
		}
		if (state == ScrollabilityCache.FADING) {
			// We're fading -- get our fade interpolation
			if (cache.interpolatorValues == null) {
				cache.interpolatorValues = new float[1];
			}
			float[] values = cache.interpolatorValues;
			// Stops the animation if we're done
			if (cache.scrollBarInterpolator.timeToValues(values) == Interpolator.Result.FREEZE_END) {
				cache.state = ScrollabilityCache.OFF;
			} else {
				// in View.class is "cache.scrollBar.mutate()"
				mThumbDrawable.setAlpha(Math.round(values[0]));
			}
			invalidate = true;
		} else {
			// reset alpha, in View.class is "cache.scrollBar.mutate()"
			mThumbDrawable.setAlpha(255);
		}
	}

	// Draw the thumb
	if (updateThumbRect(0)) {
		final int scrollY = mView.getScrollY();
		final int scrollX = mView.getScrollX();
		mThumbDrawable.setBounds(mThumbRect.left + scrollX, mThumbRect.top + scrollY, mThumbRect.right + scrollX,
				mThumbRect.bottom + scrollY);
		mThumbDrawable.draw(canvas);
	}
	if (invalidate) {
		mView.invalidate();
	}

}
 
源代码5 项目: assertj-android   文件: InterpolatorAssert.java
public InterpolatorAssert(Interpolator actual) {
  super(actual, InterpolatorAssert.class);
}
 
 类所在包
 类方法
 同包方法