Copy link to clipboard
Copied
Hi everyone. I have two expressions which im trying to combine to work on the scale property of a shape layer. The first one is a bounce expression and the second is an expression to use a slider to control the scale of a layer (on the second keyframe). It might help to check out the original thread (Controlling the scale of a shape layer using slider control and expressions. ) where I was given the second expression to get an better idea. If anyone can help that would be greatly appreciated.
Bounce expression
amp = .1;
freq = 2.0;
decay = 4.0;
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}
Expression to control scale of the layer
x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
x = ease(time,key(1).time,key(2).time,key(1).value[0],x2);
[x,x]
Like this maybe:
x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
x = ease(time,key(1).time,key(2).time,key(1).value[0],x2);
val = [x,x]
amp = .1;
freq = 2.0;
decay = 4.0;
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);
val + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}
Dan
Copy link to clipboard
Copied
With my extension ExpressionTimeline, you can combine any expressions over time. You can even smoothly transition from one expression to another one or transition from expressions to regions where to expression is active.
Expression Timeline 2 - aescripts + aeplugins - aescripts.com
For simple cases you can also combine expressions like this:
if(time < 10){
// write here the expression that should be active for the time before 10s
}
else {
// write here the expression that should be active for the time after 10s
}
Copy link to clipboard
Copied
Thanks for replaying but this method doesnt work for me. Tha bounce effects still works when I combine it using your method but I am not able to scale using the slider.
Copy link to clipboard
Copied
Like this maybe:
x2 = thisComp.layer("Null 1").effect("Slider Control")("Slider");
x = ease(time,key(1).time,key(2).time,key(1).value[0],x2);
val = [x,x]
amp = .1;
freq = 2.0;
decay = 4.0;
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);
val + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}
Dan
Copy link to clipboard
Copied
That work perfectly. Thanks a bunch Dan ![]()
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more