Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Time based position ‘slide’ expression jumps when triggered with marker

  • Time based position ‘slide’ expression jumps when triggered with marker

    Posted by Matthew Talesfore on January 7, 2013 at 8:01 pm

    Hey everyone,

    First time poster, long time reader.

    So I am trying to make some text slide at a controllable/duplicatable/constant velocity.
    The text drops down and then slides to the right. I was trying to use a marker to delay triggering the slide until the text has dropped down.

    I cobbled a couple expressions together which has gotten me really close.
    However when the marker triggers the expression, the text jumps to the position it would have been at, if the expression not been delayed.

    I think this is due to the time being read as absolute and not relative, which I think is what I need.
    I have no idea how to fix this so any help the community can offer would be great.
    I have included the CS6 project file.
    5174_delayslideexpression.aep.zip

    Thank you in advance

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    value;
    } else {
    // Throw (move at a constant speed without keyframes)
    veloc = 40; //horizontal velocity (pixels per second)
    x = position[0] + (time - inPoint) *veloc;
    y = position[1];
    [x,y]
    }

    Dan Ebberts
    replied 13 years, 4 months ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    January 7, 2013 at 8:10 pm

    Try it this way:


    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }
    if (n == 0){
    value;
    } else {
    t = time - marker.key(n).time;
    veloc = 40; //horizontal velocity (pixels per second)
    value + [t*veloc,0]
    }

    Dan

  • Matthew Talesfore

    January 7, 2013 at 10:48 pm

    Dan a million thank yous!
    Wow, 9min for a response, kind of slow 😉

    Your adjustment works brilliantly!
    I am not even going to try and pretend that I understand what you did there. I will spend the rest of the month trying to figure it out.

    Is there an expression/javascript topic you might recommend I read up on, to better understand this?

    Thanks again,

    Matthew

  • Dan Ebberts

    January 7, 2013 at 11:03 pm

    The only real change I made was to use the time elapsed since the marker rather than the time elapsed since the layer’s in point to calculate the x distance traveled.

    Dan

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