Math.floor(time*n)*m
n代表每秒旋转的次数,m代表每次旋转的幅度。
回弹表达式
nearestKeyIndex = 0;
if (numKeys > 0){
nearestKeyIndex = nearestKey(time).index;
if (key(nearestKeyIndex).time > time){
nearestKeyIndex--;
}
}
if (nearestKeyIndex == 0) {
currentTime = 0;
} else {
currentTime = time - key(nearestKeyIndex).time;
}
if (nearestKeyIndex > 0 && currentTime < 1) {
calculatedVelocity = velocityAtTime(key(nearestKeyIndex).time - thisComp.frameDuration / 10);
amplitude = 0.04;// 反弹的力度&距离,值越大 反弹越强烈
frequency = 2.0;// 频率,每秒反弹次数
decay = 6.0;// 衰减,数值越大,越快停止
value + calculatedVelocity * amplitude * Math.sin(frequency * currentTime * 2 * Math.PI) / Math.exp(decay * currentTime);
} else {
value;
}
网友评论