예제 #1
0
        protected internal override void ComputeRender(float renderProgress)
        {
            if (mCurrentBounds.IsEmpty)
            {
                return;
            }

            if (mWaitPath.IsEmpty)
            {
                mWaitPath.Set(CreateWaitPath(mCurrentBounds));
                mWaitPathMeasure.SetPath(mWaitPath, false);
                mWaitPathLength = mWaitPathMeasure.Length;

                mOriginEndDistance   = mWaitPathLength * 0.255f;
                mOriginStartDistance = mWaitPathLength * 0.045f;
            }

            mCurrentTopWaitPath.Reset();
            mCurrentMiddleWaitPath.Reset();
            mCurrentBottomWaitPath.Reset();

            //Draw the first half : top
            if (renderProgress <= WAIT_TRIM_DURATION_OFFSET)
            {
                float topTrimProgress  = ACCELERATE_DECELERATE_INTERPOLATOR.GetInterpolation(renderProgress / WAIT_TRIM_DURATION_OFFSET);
                float topEndDistance   = mOriginEndDistance + mWaitPathLength * 0.3f * topTrimProgress;
                float topStartDistance = mOriginStartDistance + mWaitPathLength * 0.48f * topTrimProgress;
                mWaitPathMeasure.GetSegment(topStartDistance, topEndDistance, mCurrentTopWaitPath, true);
            }

            //Draw the first half : middle
            if (renderProgress > 0.02f * WAIT_TRIM_DURATION_OFFSET && renderProgress <= WAIT_TRIM_DURATION_OFFSET * 0.75f)
            {
                float middleStartTrimProgress = ACCELERATE_INTERPOLATOR10.GetInterpolation((renderProgress - 0.02f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.73f));
                float middleEndTrimProgress   = DECELERATE_INTERPOLATOR08.GetInterpolation((renderProgress - 0.02f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.73f));

                float middleEndDistance   = mOriginStartDistance + mWaitPathLength * 0.42f * middleEndTrimProgress;
                float middleStartDistance = mOriginStartDistance + mWaitPathLength * 0.42f * middleStartTrimProgress;
                mWaitPathMeasure.GetSegment(middleStartDistance, middleEndDistance, mCurrentMiddleWaitPath, true);
            }

            //Draw the first half : bottom
            if (renderProgress > 0.04f * WAIT_TRIM_DURATION_OFFSET && renderProgress <= WAIT_TRIM_DURATION_OFFSET * 0.75f)
            {
                float bottomStartTrimProgress = ACCELERATE_INTERPOLATOR15.GetInterpolation((renderProgress - 0.04f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.71f));
                float bottomEndTrimProgress   = DECELERATE_INTERPOLATOR05.GetInterpolation((renderProgress - 0.04f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.71f));

                float bottomEndDistance   = mOriginStartDistance + mWaitPathLength * 0.42f * bottomEndTrimProgress;
                float bottomStartDistance = mOriginStartDistance + mWaitPathLength * 0.42f * bottomStartTrimProgress;
                mWaitPathMeasure.GetSegment(bottomStartDistance, bottomEndDistance, mCurrentBottomWaitPath, true);
            }

            //Draw the last half : top
            if (renderProgress <= END_TRIM_DURATION_OFFSET && renderProgress > WAIT_TRIM_DURATION_OFFSET)
            {
                float trimProgress     = ACCELERATE_DECELERATE_INTERPOLATOR.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET) / (END_TRIM_DURATION_OFFSET - WAIT_TRIM_DURATION_OFFSET));
                float topEndDistance   = mOriginEndDistance + mWaitPathLength * 0.3f + mWaitPathLength * 0.45f * trimProgress;
                float topStartDistance = mOriginStartDistance + mWaitPathLength * 0.48f + mWaitPathLength * 0.27f * trimProgress;
                mWaitPathMeasure.GetSegment(topStartDistance, topEndDistance, mCurrentTopWaitPath, true);
            }

            //Draw the last half : middle
            if (renderProgress > WAIT_TRIM_DURATION_OFFSET + 0.02f * WAIT_TRIM_DURATION_OFFSET && renderProgress <= WAIT_TRIM_DURATION_OFFSET + WAIT_TRIM_DURATION_OFFSET * 0.62f)
            {
                float middleStartTrimProgress = ACCELERATE_INTERPOLATOR08.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.02f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.60f));
                float middleEndTrimProgress   = DECELERATE_INTERPOLATOR03.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.02f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.60f));

                float middleEndDistance   = mOriginStartDistance + mWaitPathLength * 0.48f + mWaitPathLength * 0.20f * middleEndTrimProgress;
                float middleStartDistance = mOriginStartDistance + mWaitPathLength * 0.48f + mWaitPathLength * 0.10f * middleStartTrimProgress;
                mWaitPathMeasure.GetSegment(middleStartDistance, middleEndDistance, mCurrentMiddleWaitPath, true);
            }

            if (renderProgress > WAIT_TRIM_DURATION_OFFSET + 0.62f * WAIT_TRIM_DURATION_OFFSET && renderProgress <= END_TRIM_DURATION_OFFSET)
            {
                float middleStartTrimProgress = DECELERATE_INTERPOLATOR10.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.62f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.38f));
                float middleEndTrimProgress   = DECELERATE_INTERPOLATOR03.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.62f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.38f));

                float middleEndDistance   = mOriginStartDistance + mWaitPathLength * 0.68f + mWaitPathLength * 0.325f * middleEndTrimProgress;
                float middleStartDistance = mOriginStartDistance + mWaitPathLength * 0.58f + mWaitPathLength * 0.17f * middleStartTrimProgress;
                mWaitPathMeasure.GetSegment(middleStartDistance, middleEndDistance, mCurrentMiddleWaitPath, true);
            }

            //Draw the last half : bottom
            if (renderProgress > WAIT_TRIM_DURATION_OFFSET + 0.10f * WAIT_TRIM_DURATION_OFFSET && renderProgress <= WAIT_TRIM_DURATION_OFFSET + WAIT_TRIM_DURATION_OFFSET * 0.70f)
            {
                float bottomStartTrimProgress = ACCELERATE_INTERPOLATOR15.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.10f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.60f));
                float bottomEndTrimProgress   = DECELERATE_INTERPOLATOR03.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.10f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.60f));

                float bottomEndDistance   = mOriginStartDistance + mWaitPathLength * 0.48f + mWaitPathLength * 0.20f * bottomEndTrimProgress;
                float bottomStartDistance = mOriginStartDistance + mWaitPathLength * 0.48f + mWaitPathLength * 0.10f * bottomStartTrimProgress;
                mWaitPathMeasure.GetSegment(bottomStartDistance, bottomEndDistance, mCurrentBottomWaitPath, true);
            }

            if (renderProgress > WAIT_TRIM_DURATION_OFFSET + 0.70f * WAIT_TRIM_DURATION_OFFSET && renderProgress <= END_TRIM_DURATION_OFFSET)
            {
                float bottomStartTrimProgress = DECELERATE_INTERPOLATOR05.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.70f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.30f));
                float bottomEndTrimProgress   = DECELERATE_INTERPOLATOR03.GetInterpolation((renderProgress - WAIT_TRIM_DURATION_OFFSET - 0.70f * WAIT_TRIM_DURATION_OFFSET) / (WAIT_TRIM_DURATION_OFFSET * 0.30f));

                float bottomEndDistance   = mOriginStartDistance + mWaitPathLength * 0.68f + mWaitPathLength * 0.325f * bottomEndTrimProgress;
                float bottomStartDistance = mOriginStartDistance + mWaitPathLength * 0.58f + mWaitPathLength * 0.17f * bottomStartTrimProgress;
                mWaitPathMeasure.GetSegment(bottomStartDistance, bottomEndDistance, mCurrentBottomWaitPath, true);
            }
        }