2 expressions in the one property
- October 14, 2020
- 1 reply
- 250 views
Hi. Simple animation with scale, 2 keyframes:
1st - 0%, 0%
2nd - 100%, 100%
I want to add bounce effect and control the keyframe values via point control. But for some reason the point control doesn't work.
Expressions I used:
if (numKeys > 1){
t1 = key(1).time;
t2 = key(2).time;
v1=effect("Scale IN")("Point");
v2=effect("Scale OUT")("Point");
linear(time, t1, t2, v1, v2);
}else value
amp = .06;// 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;
}