Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Amend existing marker trigger to include marker.name

  • Amend existing marker trigger to include marker.name

    Posted by Roland R. kahlenberg on November 2, 2014 at 2:53 am

    I’d like to be able to have different behaviors triggered by different markers. The current code only looks at the marker time. How can I amend this code so that it reads a marker’s name, like “scale”.

    try {
    n = 0;
    t = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }
    if (n > 0) t = time - marker.key(n).time;

    amp = 15;
    freq = 5;
    decay = 3.0;

    angle = freq * 2 * Math.PI * t;
    scaleFact = (100 + amp * Math.sin(angle) / Math.exp(decay * t)) / 100;
    [value[0] * scaleFact, value[1] / scaleFact];
    }
    catch (err) {[100,100]}

    TIA
    – Roland

    TypeGEMs – the Definitive Type Gizmo for AE
    https://broadcastgems.com/typegems/

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations
    Adobe After Effects CC ACE/ACI
    Imagineer Systems (mocha) Certified Instructor

    https://www.broadcastgems.com/mographintensity_shapestext/

    Dan Ebberts replied 11 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    November 2, 2014 at 5:24 am

    I haven’t tested this, so there may be typos, but I’m guessing what you’re trying to do will be structured like this:


    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }
    if (n > 0){
    comment = marker.key(n).comment;
    t = time - marker.key(n).time;
    switch (comment){
    case "scale":
    // do something
    break;
    case "other":
    // do something different
    break;
    default:
    break;
    }
    }else
    value

    Dan

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