1.运动回弹 Keyframe Overshoot:
freq = 3;
decay = 5;
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n > 0){
t = time - key(n).time;
amp = velocityAtTime(key(n).time - .001);
w = freq*Math.PI*2;
value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}else
value
2.物体下缀重力回弹 Keyframe Bounce Back:
e = .7;
g = 5000;
nMax = 9;
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n > 0){
t = time - key(n).time;
v = -velocityAtTime(key(n).time - .001)*e;
vl = length(v);
if (value instanceof Array){
vu = (vl > 0) ? normalize(v) : [0,0,0];
}else{
vu = (v < 0) ? -1 : 1;
}
tCur = 0;
segDur = 2*vl/g;
tNext = segDur;
nb = 1; // number of bounces
while (tNext < t && nb <= nMax){
vl *= e;
segDur *= e;
tCur = tNext;
tNext += segDur;
nb++
}
if(nb <= nMax){
delta = t - tCur;
value + vu*delta*(vl - g*delta/2);
}else{
value
}
}else value
3.循环表达式
loopOut(type="cycle",numkeyframes=0)
Math.sin(time*5)*100, //这个表示每秒循环5次,变化的值为100
4.抖动表达式
函数:
- wiggle(freq, amp, octaves = 1, amp_mult = .5, t = time)
参数:
- freq 频率
- amp 振幅
- octaves 振幅幅度
- amp_mult 频率倍频
- t 持续时间
说明:
频率和振幅是必须具备的参数其他选填写
例如wiggle(50,100)