ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Link two markers to two keyframes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Douglas Baiden
Link two markers to two keyframes
on May 22, 2020 at 4:22:01 pm

Hi i key framed a slider to drive an animation i want to control the sliders key frames with two markers i need help with expressions please help me Thank you

L = thisComp.layer("0");
if ((L.marker.numKeys > 0) && (numKeys > 2) && (time > key(2).time)){
t2 = key(2).time;


Return to posts index

Dan Ebberts
Re: Link two markers to two keyframes
on May 22, 2020 at 4:45:26 pm

That's a little vague, but see if this does what you want:


m = thisComp.layer("0").marker;
if (m.numKeys > 1 && numKeys > 0){
t = linear(time,m.key(1).time,m.key(2).time,key(1).time,key(numKeys).time);
valueAtTime(t);
}else
value



Dan



Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 22, 2020 at 5:05:53 pm

Hi this worked perfectly Thank you

There is one other thing i would like to do if you can help me with that it is a countdown and i want the markers duration be equal to the duration of the countdown so is i drag the out maker to say 15secs the start of my number will be 15 and the position of the end maker will be 0 please is there a way to help me with that Thank you for the fast response you just awesome


Return to posts index


Dan Ebberts
Re: Link two markers to two keyframes
on May 22, 2020 at 5:18:01 pm

Maybe something like this:


if (marker.numKeys > 0){
m = marker.key(1);
linear(time,m.time,m.time+m.duration,m.duration,0).toFixed(1);
}else
0



Dan



Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 22, 2020 at 5:36:10 pm

Hi Thank you for your swift response i pasted the expressions and nothing happened am new to expressions so i dont know if am doing something wrong Please help thank you


Return to posts index

Dan Ebberts
Re: Link two markers to two keyframes
on May 22, 2020 at 5:48:15 pm

You would apply the expression to the Source Text property of a text layer, and the expression expects a split marker on that layer.

Dan



Return to posts index


Douglas Baiden
Re: Link two markers to two keyframes
on May 22, 2020 at 5:56:43 pm

Thank you for the quick response, I just applied it to the source text layer and it Gave me " 0.0 " i have two markers on the layer when i scrub in between the markers it remains 0.0 please help Thank you


Return to posts index

Dan Ebberts
Re: Link two markers to two keyframes
on May 22, 2020 at 6:03:08 pm

Ah, OK. I thought you wanted to control the duration with the duration of a sjingle, split marker. If you're using two markers, try this instead:


if (marker.numKeys > 1){
t1 = marker.key(1).time;
t2 = marker.key(2).time
linear(time,t1,t2,t1,0).toFixed(1);
}else
0



Dan



Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 22, 2020 at 6:24:51 pm

Thank you it is working but i think i am not communicating well sorry about that.
when the the first marker is at the very beginning when you scrub in between its 0.0 when you move the first marker forward say 5 seconds that when it works and starts from 5 seconds till 0 where the second marker is.

What I am looking for is for the last marker determines the end of the timer that is zero and the first maker at the beginning is the start of the timer which value is base on the current position of the last marker. So eg. if i move the last marker to say 15 seconds the value of the timer at the beginning starts at 15 in if i move it to 20 seconds the beginning value is 20 the last maker position will always have zero when put the play head at its position so basically i can control the countdowns duration with the last marker. Thank you for the help i appreciate it


Return to posts index


Dan Ebberts
Re: Link two markers to two keyframes
on May 22, 2020 at 6:32:03 pm

Like this, I guess:


if (marker.numKeys > 1){
t1 = marker.key(1).time;
t2 = marker.key(2).time
linear(time,t1,t2,t2,0).toFixed(1);
}else
0


Dan



Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 22, 2020 at 6:38:45 pm

This Awesome it worked ☺ You are a life saver ☺

Please is the a way to round the number without getting a decimal point Thank you


Return to posts index

Dan Ebberts
Re: Link two markers to two keyframes
on May 22, 2020 at 6:40:29 pm

Like this:


if (marker.numKeys > 1){
t1 = marker.key(1).time;
t2 = marker.key(2).time
linear(time,t1,t2,t2,0).toFixed(0);
}else
0



Dan



Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 22, 2020 at 7:10:15 pm

Awwwwww dis is just Awesome Many thanks you just grt and very patient say save the world needs you Thank you an get bless a million folds ☺


Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 22, 2020 at 11:50:56 pm

Hi Dan Thanks for the previous help Please is the a way to reverse this so it is the other way round i want to add this to my project so the user of the template can also get a reversed version Thank you

if (marker.numKeys > 1){
t1 = marker.key(1).time;
t2 = marker.key(2).time
linear(time,t1,t2,t2,0).toFixed(0);
}else
0


Return to posts index

Dan Ebberts
Re: Link two markers to two keyframes
on May 23, 2020 at 12:36:01 am

>reverse this so it is the other way round

What do you mean by that, exactly?



Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 23, 2020 at 1:00:11 am

Thanks for the swift responds Dan Ok so the expressions the counter or text value stats from the time where the second marker is with the reverse i want it to be zero so the second marker matches the time it is at eg marker one is 0sec maker two is 30sec the previous expression is 30sec for marker 1 and 0sec for marker two which is exactly what i wanted i want to add a reverse of this so i create a reversed counting from 0 - .........


Return to posts index

Dan Ebberts
Re: Link two markers to two keyframes
on May 23, 2020 at 2:42:51 am

I haven't test this, but I think it would be:


if (marker.numKeys > 1){
t1 = marker.key(1).time;
t2 = marker.key(2).time
linear(time,t1,t2,0,t2).toFixed(0);
}else
0



Dan



Return to posts index

Douglas Baiden
Re: Link two markers to two keyframes
on May 23, 2020 at 3:01:36 am

Thanks so much it worked like a charm am very grateful 😃


Return to posts index

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