Copy link to clipboard
Copied
Is there any way that I can patch the same expression in the same property layer multiple times? What if I would like my camera to execute the same expression at different points in the composition?
Something like this should work:
freq = 1;
amp = 25;
n = 0;
if (thisProperty.numKeys > 0){
n = thisProperty.nearestKey(time).index;
if (thisProperty.key(n).time > time) n--;
}
if (n > 0 && n < thisProperty.numKeys && n%2 == 0){
t1 = thisProperty.key(n).time;
t2 = thisProperty.key(n+1).time;
if (time > (t1 + t2)/2)
easeOut(time,t1,t2,wiggle(freq,amp),value)
else
easeIn(time,t1,t2,value,wiggle(freq,amp));
}else
value
Dan
Copy link to clipboard
Copied
It's possible to set an expression up so that it is triggered by markers or runs at specific times, but the specifics depend on what it is you're trying to do.
Dan
Copy link to clipboard
Copied
Can they also be triggered by keyframes?
Copy link to clipboard
Copied
Yes. The way you would do it depends on what you're trying to accomplish though.
Dan
Copy link to clipboard
Copied
Ok, let try to explain.
In the picture below, I have about 10 keyframes in the position property of the Camera Master layer. I'm trying to assign a wiggle expression in between the keyframes that are separated furthest from each other. For example, if I we're to go by numeric order, I would put the wiggle expression in between keyframes 2 and 3, 4 and 5, 6 and 7, 8 and 9, etc.
Does that make sense?
Copy link to clipboard
Copied
Something like this should work:
freq = 1;
amp = 25;
n = 0;
if (thisProperty.numKeys > 0){
n = thisProperty.nearestKey(time).index;
if (thisProperty.key(n).time > time) n--;
}
if (n > 0 && n < thisProperty.numKeys && n%2 == 0){
t1 = thisProperty.key(n).time;
t2 = thisProperty.key(n+1).time;
if (time > (t1 + t2)/2)
easeOut(time,t1,t2,wiggle(freq,amp),value)
else
easeIn(time,t1,t2,value,wiggle(freq,amp));
}else
value
Dan
Copy link to clipboard
Copied
Whoa! That did do the trick, yes! Thank you so much! From the way it looks, I gotta long way to go before I master expressions...
Copy link to clipboard
Copied
Would there be any way to omit keyframes in that same layer from this expression? Or does the expression itself occupy the entire layer unconditionally?
Copy link to clipboard
Copied
The expressin always controls the value, but just like between odd and even keyframes, you can define regions where the expression's result is "value" which tells the expression to just use the property's pre-expression (keyframed) value. It's hard to give a general answer though, because the solution always depends on exactly what it is you're trying to do.
Dan
Find more inspiration, events, and resources on the new Adobe Community
Explore Now