ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Composition markers to trigger in and out of a TR precomp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Roei Tzoref
Composition markers to trigger in and out of a TR precomp
on Oct 14, 2017 at 11:53:54 pm

Hi Expressionists

I am trying to make composition markers named IN and OUT in my main comp to trigger different precomps TR property. so far the most elegant way I found is through digging in a friend's solution which is dividing the expression in two.

here it is:
say I have in my precomp animation setup that starts from 00:00:00 - 00:02:00 and animation out starts in 00:12:00-00:14:00

I apply this to the TR property:
IN= thisComp.marker.key(1).time;
OUT = thisComp.marker.key(2).time;
action=thisComp.layer("marker index").effect("Maker index inOut")("Slider");

if (action==1) { linear(time,IN,IN+2,0,2) };
if (action==2){linear(time,OUT,OUT+2,12,14) } ;
if (action>2){[0]}
if (action==0){[0]}

and in another layer I add a slider and apply this expression:
try{
action=thisComp;
n = 0;
if (action.marker.numKeys > 0){
n = action.marker.nearestKey(time).index;
if ( action.marker.key(n).time > time){
n--;
}
}

n
} catch (err) {
0
}

and it works. but I want something easier, maybe more elegant that I could maybe understand. try-catch is beyond me. maybe this can work with only one layer?

it's not bad. I get the first expression, it's the other one I want to lose or to understand ☺

the basic setup looks like this so far.

but it will get more complex, I just wanted to see I figured how to do it. now I can place any animation I want in the precomp. the purpose is to create an easy to control lower third template with a simple rig.

thanks

IN= thisComp.marker.key(1).time;
OUT = thisComp.marker.key(2).time;
action=thisComp.layer("marker index").effect("Maker index inOut")("Slider");

if (action==1) { linear(time,IN,IN+2,0,2) };
if (action==2){linear(time,OUT,OUT+2,12,14) } ;
if (action>2){[0]}
if (action==0){[0]}


---------------second expression ------------
try{
action=thisComp;
n = 0;
if (action.marker.numKeys > 0){
n = action.marker.nearestKey(time).index;
if ( action.marker.key(n).time > time){
n--;
}
}

n
} catch (err) {
0
}


Roei Tzoref
2D/VFX Generalist & Instructor
♫ AeBlues Tutorials ♫
http://www.tzoref.com


Return to posts index

Dan Ebberts
Re: Composition markers to trigger in and out of a TR precomp
on Oct 15, 2017 at 12:03:45 am

I would think something like this would be all you need:


IN= thisComp.marker.key(1).time;
OUT = thisComp.marker.key(2).time;
if (time < OUT)
linear(time,IN,IN+2,0,2)
else
linear(time,OUT,OUT+2,12,14);



Dan



Return to posts index

Roei Tzoref
Re: Composition markers to trigger in and out of a TR precomp
on Oct 15, 2017 at 12:45:56 am

Yes! and that makes sense to me too!

Thank you Dan.

Roei Tzoref
2D/VFX Generalist & Instructor
♫ AeBlues Tutorials ♫
http://www.tzoref.com


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]