【AE表达式】减震与弹性

https://videolancer.net/damping

如何使用

放在K了帧的关键帧上

减震

【AE表达式】减震与弹性

amp = .04;// The higher the value, the greater the amplitude
freq = 2;// The higher the value, the higher the frequency
decay = 5;// The higher the value, the smaller the delay

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

弹性

【AE表达式】减震与弹性

e = .3; // Bouncing
g = 1; // Gravity
nMax = 10; // Maximum bounces

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*1000);
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*1000)*delta/2);
}else{
value
}
}else
value

 

给TA充电
共{{data.count}}人
人已充电
AEAE文章AE表达式

【AE表达式】路径自动定向

2021-12-14 15:01:02

AEAE文章AE表达式

【AE表达式】3D图层朝向摄像机

2021-12-14 15:26:55

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
搜索