Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions TimeRemap Using a Marker

  • TimeRemap Using a Marker

    Posted by Mackie John on November 22, 2020 at 11:34 am

    I’m trying to play a timeRemap on a precom, i.e. play a section of the precomp once the CurrentTimeIndicator hits a marker on another layer.

    I found this script : https://www.motionscript.com/design-guide/marker-sync.html

    action = comp(“Comp 1”).layer(“Marker”);
    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;

    if (marker.key(n).time > time){
    n–;

    }
    }

    if (n == 0){
    0
    }else{
    m = marker.key(n);
    myComment = m.comment;

    t = time – m.time;
    try{
    actMarker = action.marker.key(myComment);
    if (action.marker.numKeys > actMarker.index){
    tMax = action.marker.key(actMarker.index + 1).time – actMarker.time;
    }else{
    tMax = action.outPoint – actMarker.time;
    }
    t = Math.min(t, tMax);
    actMarker.time + t;

    }catch (err){
    0
    }
    }

    How can I modify this to achieve what I’m trying to do. If you see above I pointed it to the marker layer in comp 1. This layer has 1 marker. Now when the CTI hits this marker I want the timeremap to execute. I Have set the above script on the timeRemap property of the precomp I need to play. But nothing seems to happen. It stays at 0.

    Mackie John replied 5 years, 5 months ago 1 Member · 1 Reply
  • 1 Reply
  • Mackie John

    November 22, 2020 at 11:57 am

    I got this working with the following script (had to point to the right action var)

    action = comp(“Comp 1”).layer(“Marker”);
    n = 0;
    //test = action.marker.numKeys;
    if (action.marker.numKeys > 0){
    n = action.marker.nearestKey(time).index;

    if (action.marker.key(n).time > time){
    n–;

    }
    }

    if (n == 0){
    0
    }else{
    m = action.marker.key(n);
    myComment = m.comment;
    test = myComment;
    t = time – m.time;
    }

    try{
    actMarker = action.marker.key(myComment);
    if (action.marker.numKeys > actMarker.index){
    tMax = action.marker.key(actMarker.index + 1).time – actMarker.time;
    }else{
    tMax = action.outPoint – actMarker.time;
    }
    t = Math.min(t, tMax);
    actMarker.time + t;

    }catch (err){
    0
    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy