示例#1
0
    private Keyframe GetInterpolatedKeyframeLinear(float time, int keyframeIndex, float timebetweenKeyframes)
    {
        float    fractionTime      = time / timebetweenKeyframes;
        int      lowKeyframeIndex  = Mathf.FloorToInt(fractionTime);
        int      highKeyframeIndex = Mathf.CeilToInt(fractionTime);
        Keyframe lowKeyframe       = keyframes[lowKeyframeIndex];
        Keyframe highKeyframe      = keyframes[highKeyframeIndex];
        float    subFrameParam     = fractionTime % 1;

        return(Keyframe.Lerp(lowKeyframe, highKeyframe, subFrameParam));
    }