Activity › Forums › Adobe After Effects Expressions › Play and Pause on markers
-
Dan Ebberts
October 21, 2015 at 11:14 pmThis might work:
m = thisLayer.marker;
easeTime = .25;
if (m.numKeys > 0){
i = m.nearestKey(time).index;
if (m.nearestKey(time).time > time) i--;
if (i > 0){
t = time - m.key(i).time;
if (i%2){
ease(t,0,easeTime,100,0);
}else{
ease(t,0,easeTime,0,100);
}
}else{
100;
}
}else{
100;
}
Dan
-
Jan Hofmeister
April 3, 2019 at 8:55 pmBringing this oooold thread back up, I was wondering how Dan’s expression up there needs to be changed to not play and stop at each marker, but always stop at each marker and only play for the duration of a marker (you know, when you split and drag it apart with ALT and click).
So basically the time between markers is the hold time, and the duration of each marker is play time. That way it’s a bit more practical for time-remapping purposes, because moving a marker will always move its duration along with it.
-
Dan Ebberts
April 3, 2019 at 11:44 pmSomething like this maybe:
m = thisLayer.marker;
accum = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.nearestKey(time).time > time) n--;
if (n > 0){
for (i = 1; i < n; i++){
accum += m.key(i).duration;
}
accum += Math.min(time-m.key(n).time,m.key(n).duration);
}
}
accum
Dan
-
Paul Roper
April 15, 2021 at 9:25 amContinuing this conversation (from 6 years ago!), I’m looking for a similar way to start playing a layer when it reaches a marker. Here’s my situation:
I have a comp about 2 mins. long. At about 30 intervals (not regular) along the timeline, I want a short (finger click) sound to play. I could just put 30 layers of the sound in the comp and drag them to the appropriate time – but that just seems messy! So I was wondering if there’s a neater, marker-driven approach. I was thinking something like this:
1. Null layer with markers where I want the clicks.
2. AIFF sound layer, with an expression on it to set its time remapping to 0 each time a marker on the Null layer is encountered, so it plays from the start.
Might that work?Thanks in advance for any help!!
-
Dan Ebberts
April 15, 2021 at 12:52 pmGive this time remapping expression a try:
m = thisComp.layer("Null 1").marker;
t = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
t = (n > 0) ? time - m.key(n).time : 0;
}
t
-
Paul Roper
April 15, 2021 at 1:02 pmAs ever, Dan, you are an absolute hero of After Effects! The world of motion graphics people collectively bows down before your expressioneering greatness!
Reply to this Discussion! Login or Sign Up