Activity › Forums › Adobe After Effects Expressions › Link two markers to two keyframes
-
Link two markers to two keyframes
Posted by Douglas Baiden on May 22, 2020 at 4:22 pmHi 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;Douglas Baiden replied 6 years, 4 months ago 2 Members · 17 Replies -
17 Replies
-
Dan Ebberts
May 22, 2020 at 4:45 pmThat’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
-
Douglas Baiden
May 22, 2020 at 5:05 pmHi 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
-
Dan Ebberts
May 22, 2020 at 5:18 pmMaybe 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
-
Douglas Baiden
May 22, 2020 at 5:36 pmHi 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
-
Dan Ebberts
May 22, 2020 at 5:48 pmYou would apply the expression to the Source Text property of a text layer, and the expression expects a split marker on that layer.
Dan
-
Douglas Baiden
May 22, 2020 at 5:56 pmThank 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
-
Dan Ebberts
May 22, 2020 at 6:03 pmAh, 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
-
Douglas Baiden
May 22, 2020 at 6:24 pmThank 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
-
Dan Ebberts
May 22, 2020 at 6:32 pmLike 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
-
Douglas Baiden
May 22, 2020 at 6:38 pmThis Awesome it worked ☺ You are a life saver ☺
Please is the a way to round the number without getting a decimal point Thank you
Reply to this Discussion! Login or Sign Up