Actionscript 3 如何修改此缓和功能以减少反弹?

Actionscript 3 如何修改此缓和功能以减少反弹?,actionscript-3,animation,Actionscript 3,Animation,我正在尝试修改Flash CS3提供的fl.motion.easing.bounce函数,以减少生成的动画反弹。我很感激“无反弹”有点模糊,但我希望能在理解该函数时得到任何帮助 谢谢 /** * @param t Specifies the current time, between 0 and duration inclusive. * * @param b Specifies the initial value of the animation property. * *

我正在尝试修改Flash CS3提供的
fl.motion.easing.bounce
函数,以减少生成的动画反弹。我很感激“无反弹”有点模糊,但我希望能在理解该函数时得到任何帮助

谢谢

 /**
 *  @param t Specifies the current time, between 0 and duration inclusive.
 *
 *  @param b Specifies the initial value of the animation property.
 *
 *  @param c Specifies the total change in the animation property.
 *
 *  @param d Specifies the duration of the motion.
 *
 *  @return The value of the interpolated property at the specified time.     
 */  
public static function easeOut(t:Number, b:Number,
                               c:Number, d:Number):Number
{
    if ((t /= d) < (1 / 2.75))
        return c * (7.5625 * t * t) + b;

    else if (t < (2 / 2.75))
        return c * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75) + b;

    else if (t < (2.5 / 2.75))
        return c * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375) + b;

    else
        return c * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375) + b;
}
/**
*@param t指定当前时间,介于0和持续时间之间(含0和持续时间)。
*
*@param b指定动画属性的初始值。
*
*@param c指定动画属性中的总更改。
*
*@param d指定运动的持续时间。
*
*@返回指定时间内插值属性的值。
*/  
公共静态功能输出(t:编号,b:编号,
c:编号,d:编号
{
如果((t/=d)<(1/2.75))
返回c*(7.5625*t*t)+b;
否则,如果(t<(2/2.75))
返回c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b;
否则如果(t<(2.5/2.75))
返回c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b;
其他的
返回c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b;
}

基本上,该函数根据4个因素返回新位置的插值:动画的当前时间、动画属性的初始值、要完成的动画的总更改以及动画的总持续时间

你有一个不同的计时检查:如果动画仍然没有达到总持续时间的36%(1/2.75),应用第一个等式;如果介于36%和72%之间,则采用第二种方法;等等

每个方程都是一个函数,取决于第一个树参数,所以基本上你需要稍微调整它们

我建议玩硬编码的7.5625(让它变大变小,看看结果),直到你满意为止



7.5625
Math.pow(2.75,2),但硬编码以节省处理时间。

我知道这也不会给你一个明确的答案,但这些方程是罗伯特·彭纳在他的书中首次提出的。我知道这不是一个简单的答案,但在他的书中,他详细解释了这些函数是如何工作的。要真正理解,你可能需要拿起一份副本,深入研究。

试着扩大第一次触地时间,减少弹跳时间,我把第一次整个距离设为1.4/2.7,然后是1.4~2.1,这个范围是0.7,半范围是0.35,0.35*0.35=0.1225,1-0.1225=0.8775,如果你想降低弹跳范围,看起来不错,尝试使用这个概念:减小两个时间点的范围

    t /= d;
    if (t < 1.4 / 2.75) {
        return 3.858419 * t * t;
    }
    else if (t < 2.1 / 2.75) {
        t -= 1.75f / 2.75;
        return 7.5625 * t * t + 0.8775f;
    }
    else if (t < 2.5 / 2.75) {
        t -= 2.3f / 2.75;
        return 7.5625 * t * t + 0.96f;
    }
    t -= 2.625f / 2.75;
    return 7.5625 * t * t + 0.984375f;
t/=d;
如果(t<1.4/2.75){
返回3.858419*t*t;
}
否则如果(t<2.1/2.75){
t-=1.75f/2.75;
返回7.5625*t*t+0.8775f;
}
否则如果(t<2.5/2.75){
t-=2.3f/2.75;
返回7.5625*t*t+0.96f;
}
t-=2.625f/2.75;
返回7.5625*t*t+0.984375f;