LauncherEdgeEffect.java 文件源码

java
阅读 44 收藏 0 点赞 0 评论 0

项目:FlickLauncher 作者:
/**
 * Draw into the provided canvas. Assumes that the canvas has been rotated
 * accordingly and the size has been set. The effect will be drawn the full
 * width of X=0 to X=width, beginning from Y=0 and extending to some factor <
 * 1.f of height.
 *
 * @param canvas Canvas to draw into
 * @return true if drawing should continue beyond this frame to continue the
 *         animation
 */
public boolean draw(Canvas canvas) {
    update();

    final float centerX = mBounds.centerX();
    final float centerY = mBounds.height() - mRadius;

    canvas.scale(1.f, Math.min(mGlowScaleY, 1.f) * mBaseGlowScale, centerX, 0);

    final float displacement = Math.max(0, Math.min(mDisplacement, 1.f)) - 0.5f;
    float translateX = mBounds.width() * displacement / 2;
    mPaint.setAlpha((int) (0xff * mGlowAlpha));
    canvas.drawCircle(centerX + translateX, centerY, mRadius, mPaint);

    boolean oneLastFrame = false;
    if (mState == STATE_RECEDE && mGlowScaleY == 0) {
        mState = STATE_IDLE;
        oneLastFrame = true;
    }

    return mState != STATE_IDLE || oneLastFrame;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号