Activity › Forums › Adobe After Effects Expressions › Controling outro effects with layer outPoint
-
Controling outro effects with layer outPoint
Posted by Alfred Timotei on January 17, 2015 at 2:34 pmHello,
I want to make a modular project, in which I can drag the modules (compositions) from the project panel and drop them in the master composition.
Every module will have multiple layers with in and out effects, this means 4 keyframes for every layer (minimum).
I want to be able to adjust the out effect (the position in timeline of the last 2 keyframes) using the outPoint of the module in the Master composition.
I know how to use the outPoint to return the seconds value, but I don’t know how to modify the keyframes positions in timeline using expressions to assign the value from the outpoint.
Alfred Timotei replied 11 years, 3 months ago 2 Members · 5 Replies -
5 Replies
-
Dan Ebberts
January 17, 2015 at 8:52 pmThe problem is that an expression has no way to access a parent comp in which its own comp is nested, except by name. So you can’t do something like “find the out point of this comp as a layer in its parent comp”.
Dan
-
Alfred Timotei
January 17, 2015 at 9:37 pmHi Dan,
I managed to access the time value in seconds from the comp that I need. The problem is how I set the last 2 keyframes to match that value. That is my problem.
I have 3 sections in the timeline 1.intro effect 2.still 3.outro effect. I must move the last 2 keyframes but the distance between them must remain the same. Only the duration of the still must modify.
Best regards,
Alfred -
Dan Ebberts
January 17, 2015 at 9:59 pmExpressions can’t move keyframes, but try this:
op = comp("Comp 1").layer("Comp 2").outPoint;
if (numKeys > 1){
n = numKeys;
v1 = key(n-1).value;
v2 = key(n).value;
t1 = key(n-1).time;
t2 = key(n).time;
if ((time > t1) || (time > op-(t2-t1)))
linear(time,op-(t2-t1),op,v1,v2)
else
value;
}else
value
Dan
-
Alfred Timotei
January 17, 2015 at 10:26 pmThank you very much Dan, it’s working great, it’s exactly what I needed.
Best regards,
Alfred -
Alfred Timotei
January 20, 2015 at 9:08 amHi again Dan, I’ve run into another problem. 😀
I saw that I can use easeIn or easeOut instead of linear, but for the sake of design I wanted to use the Ease and Wizz ExpoOut and ExpoIn.
How can I combine the two blocks of code? Basically, I want the ExpoOut or ExpoIn affect only the last 2 keframes.
Best regards,
Alfredop = comp("Corporate 1 MAIN COMPOSITION").layer("1 Intro Logo").outPoint-0.034;
if (numKeys > 1){
n = numKeys;
v1 = key(n-1).value;
v2 = key(n).value;
t1 = key(n-1).time;
t2 = key(n).time;
if ((time > t1) || (time > op-(t2-t1)))
easeOut(time,op-(t2-t1),op,v1,v2)
else
value;
}else
value// Ease and Wizz 2.0.3 : outExpo : All keyframes
// Ian Haigh (https://ianhaigh.com/easeandwizz/)
// Last built: 2012-10-11T16:37:31+11:00// some defaults
var p = 0.8; // period for elastic
var a = 50; // amplitude for elastic
var s = 1.70158; // overshoot amount for "back"function easeandwizz_outExpo(t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
}function easeAndWizz() {
var n = 0;
if (numKeys > 0) {
n = nearestKey(time).index;
if (key(n).time > time) { n-- }
}try {
var key1 = key(n);
var key2 = key(n+1);
} catch(e) {
return null;
}// determine how many dimensions the keyframes need
var dim = 1; // It's gotta have at least ONE dimension
try {
key(1)[1];
dim = 2;
key(1)[2];
dim = 3;
} catch(e) {}t = time - key1.time;
d = key2.time - key1.time;sX = key1[0];
eX = key2[0] - key1[0];if (dim >= 2) {
sY = key1[1];
eY = key2[1] - key1[1];if (dim >= 3) {
sZ = key1[2];
eZ = key2[2] - key1[2];
}
}if ((time < key1.time) || (time > key2.time)) {
return value;
} else {
val1 = easeandwizz_outExpo(t, sX, eX, d, a, p, s);
switch (dim) {
case 1:
return val1;
break;
case 2:
val2 = easeandwizz_outExpo(t, sY, eY, d, a, p, s);
return [val1, val2];
break;
case 3:
val2 = easeandwizz_outExpo(t, sY, eY, d, a, p, s);
val3 = easeandwizz_outExpo(t, sZ, eZ, d, a, p, s);
return [val1, val2, val3];
break;
default:
return null;
}
}
}(easeAndWizz() || value);
Reply to this Discussion! Login or Sign Up
