Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for constant speed?

  • Expression for constant speed?

    Posted by Ben G unguren on January 26, 2012 at 9:52 pm

    Hi all

    I have over a hundred paths being carved out with multiple instances of the Write-on effect with the 2D Brush Position being animated. Some of these paths are quite long, others pretty short, and I’m trying to figure out an expression that could cause each to move at the same speed.

    I know the expression would be applied to the “Brush Position” attribute, and I extract speed from that, and I’m thinking it has something to do with modifying the (time) in value_at_time(time) for “Brush Position”, but my attempts so far keep failing. Does anyone have any advice? Thanks!

    Ben Unguren
    Motion Graphics & Editing
    http://www.mostlydocumentary.com

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Vimeo framework” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

    Ben G unguren replied 14 years, 3 months ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    January 26, 2012 at 10:43 pm

    Hmmm… I think it’s possible. It would be easier if your keyframes are roving, so the actual speed is constant and the expression would only have to sample it once. One question though is when to start the movement. First keyframe? In point? Time = 0?

    Dan

  • Ben G unguren

    January 26, 2012 at 10:57 pm

    Those are good points, Dan, thanks.

    Yes, so far I’ve been using roving keyframes. I figured I can and ease the expression if I needed to.

    I didn’t even think about when to start the expression. I was thinking I would have multiple effects on a single layer, so it would probably need to be at the first keyframe for each expression.

    So… I could sample the speed at the frame after the first keyframe — that makes sense. But how could I reverse engineer the speed to influence the resulting position?

    Ben Unguren
    Motion Graphics & Editing
    http://www.mostlydocumentary.com

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Vimeo framework” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Dan Ebberts

    January 27, 2012 at 12:25 am

    The speed at the first keyframe multiplied by the time elapsed between the first and last keyframes gives you the total distance traveled (in pixels). Divide that by the control speed to get the corresponding time after the first keyframe where you want to sample the position with valueAtTime(). It should work.

    Dan

  • Ben G unguren

    January 27, 2012 at 12:29 am

    Thank you sir!

    Ben Unguren
    Motion Graphics & Editing
    http://www.mostlydocumentary.com

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Vimeo framework” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Dan Ebberts

    January 27, 2012 at 12:48 am

    I think I left a piece out. This seems to work:


    if (numKeys > 1){
    spd = thisComp.layer("control").effect("Slider Control")("Slider");
    t1 = key(1).time;
    t2 = key(numKeys).time;
    tTot = t2-t1;
    dTot = speedAtTime(t1)*tTot;
    deltaT = time - t1;
    valueAtTime(linear(deltaT*spd,0,dTot,t1,t2))
    }else
    value

    Dan

  • Ben G unguren

    January 27, 2012 at 1:01 am

    Works perfectly! You are singularly awesome, Mr. Ebberts.
    Your use of linear in there is great – and I can just swap in “ease” instead to soften the motion. Very helpful; that taught me a lot!

    Ben Unguren
    Motion Graphics & Editing
    http://www.mostlydocumentary.com

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Vimeo framework” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

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