Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Converting Motion Path to Keyframes – with an expression?

  • Converting Motion Path to Keyframes – with an expression?

    Posted by Doug Olberman on April 24, 2013 at 3:03 pm

    [originally posted in the general AE Forum]

    Hiya, is there an expression that will dynamically convert the bezier points of a motion path into keyframes, like when you copy a motion path made by the pen tool and paste it onto the position of a layer?

    I’m trying to create a roller-coaster-like animation where there’s a main character locked to the camera, and he’s flying along a track, flanked by repeating elements (let’s say trees) whizzing by him on either side. I don’t even need the “track” to be visible. I figured I would first lay down the “track” by making a motion path on a 3D null, then use that to parent the camera+character’s motion, as well as generate the repeating elements.

    The problem is in Echospace, which is normally great at repeating along a motion path, except only when that motion path is on the original element to begin with – NOT when the element gets its motion from a parent null.

    I know you can copy a motion path and paste it onto a layer’s position, but that’s a one-time transfer. I’d like to have something there that I can dynamically change, because I will inevitably be changing the track a lot as I edit the video…

    Is there any expression that can dynamically convert motion path data into keyframes? Or a way to get Echospace to respect the mother null?

    Doug Olberman replied 13 years ago 3 Members · 4 Replies
  • 4 Replies
  • Todd Kopriva

    April 24, 2013 at 8:46 pm

    Expressions can’t do things like create keyframes. Expressions just modify the value of the property that they’re on.

    You can create keyframes using a script.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    After Effects quality engineering
    After Effects team blog
    ———————————————————————————————————

  • Doug Olberman

    April 24, 2013 at 10:40 pm

    Ah, good to know. Any workflow you recommend for how to go about creating this track of repeating elements that a camera will move along as well… but be able to change the shape of the track at will?

  • Darby Edelen

    April 25, 2013 at 2:11 pm

    [boob weisz] “The problem is in Echospace, which is normally great at repeating along a motion path, except only when that motion path is on the original element to begin with – NOT when the element gets its motion from a parent null.”

    I’m not very familiar with Echospace but as I recall it will follow expression based animations just fine. You can “parent” the ‘original element’ to the parent null using an expression:

    l = thisComp.layer("Parent Null");
    if(thisLayer.hasParent) parent.fromWorld(l.toWorld(l.anchorPoint));
    else l.toWorld(l.anchorPoint);

    Just apply that to your source layer for Echospace and change the “Parent Null” portion to match the name of the null you want the layers to follow.

    The expression is a little more complicated than I anticipated because I just checked out Echospace and there are some nulls that Echospace creates that require a little extra code to handle 🙂

    Darby Edelen

  • Doug Olberman

    April 26, 2013 at 8:52 pm

    Amazing! Worked perfectly! Thanks so much, I’m just dipping my toe into expressions, and the toWorld/fromWorld commands are a little too far toward the deep end for me.

    Anyway, thanks again!

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