表达式
- 在 After Effects 中创建一个物体,并为其添加关键帧动画,使其在上下方向上移动。
- 选中物体,在“属性”面板中找到“位置”属性,并按住 Alt 键点击“位置”属性前的秒表图标,打开表达式编辑器。
- 在表达式编辑器中输入以下表达式:
物体左右移动 loopOut(type = "pingpong", numKeyframes =0)
上下抖动:value+[0,random(0,2),0]
随机抖动效果 wiggle(5, 20)
弹性表达式: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
小球回弹表达式:e =0.7;//弹力g =1000;//重力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 bounceswhile (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
暂无评论内容