# Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Play and Pause on markers

• # Play and Pause on markers

4 Members · 19 Posts
• ### Chris Scalzo

October 21, 2015 at 5:40 pm

I know this should be easy, but I’m trying to write a time remap expression freeze and play based on clip markers. I am surprised i couldn’t find this already made. I will post it if I figure it out.

• ### Dan Ebberts

October 21, 2015 at 6:51 pm

I’m not sure what you have in mind exactly, but since expressions have no memory, your expression will need to calculate how much play time has occurred in the past by examining each marker previous to the current time.

Dan

• ### Chris Scalzo

October 21, 2015 at 7:42 pm

I understood this, and that is the part I’m trying to figure out. I wrote this after sending the post, but I still need to write something for calculating totaltime of the odd or even marker differences.

```try{ m = thisLayer.marker; i = m.nearestKey(time).index; if (m.nearestKey(time).time > time){ i--;} if (i &lt; 1) { i = 1}; if (i%2==1) {marker.key(i).time} else {totaltime} }catch(err){0}```

• ### Dan Ebberts

October 21, 2015 at 7:47 pm

Are the odd numbers play or pause?

Dan

• ### Chris Scalzo

October 21, 2015 at 7:49 pm

My last post didn’t paste correctly. Something weird between Mac and PC text.

```try{ m = thisLayer.marker; i = m.nearestKey(time).index; if (m.nearestKey(time).time > time){ i--;} if (i &lt; 1) { i = 1}; if (i%2==1) {marker.key(i).time} else {totaltime} }catch(err){0}```

• ### Chris Scalzo

October 21, 2015 at 7:50 pm

Currently The odd numbers are pause and I’m starting clip off frozen with marker off top.

• ### Dan Ebberts

October 21, 2015 at 7:55 pm

If you’re going to post code, don’t preview your post, or all the < characters will get converted to html codes when you finally post it.

Dan

• ### Chris Scalzo

October 21, 2015 at 7:58 pm

Thanks. Was going crazy. < > test lol

• ### Dan Ebberts

October 21, 2015 at 8:43 pm

I think it will be something like this:

``` m = thisLayer.marker; if (m.numKeys > 0){ i = 1; segStart = 0; accum = 0; for (i = 1; i <= m.numKeys; i++){ if (m.key(i).time < time){ if (i%2){ accum += m.key(i).time - segStart; segStart = null; }else{ segStart = m.key(i).time; } }else{ break; } } if (segStart != null){ accum += time - segStart; } accum; }else time ```

Dan

• ### Chris Scalzo

October 21, 2015 at 8:50 pm

Looks good to me. Thanks, your biggest fan (probably not, since you are a rock star).

Viewing 1 - 10 of 19 posts