Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for stroke following a motion path?

  • Expression for stroke following a motion path?

    Posted by Julie Mullins on January 20, 2015 at 3:55 pm

    Hi guys,

    I have a fly that needs to move up and down the screen (see image), leaving behind a dotted line trail that stays on the screen. Is there any way to make an expression to have it do this so I don’t have to make a separate stroke path? I feel like there’s gotta be an easy way to do this and I haven’t been able to figure out a way yet.

    Victor Carlier replied 10 years, 7 months ago 5 Members · 13 Replies
  • 13 Replies
  • Fahd Chishty

    January 20, 2015 at 8:20 pm

    Look at the explanation of “Create a motion path from a mask, shape, or paint path” on this site: https://helpx.adobe.com/after-effects/using/assorted-animation-tools.html

    I think you should create a path first and then make your fly follow that path. You can add dashes and trim path animation to follow the fly.

    I am attaching a sample for your ease.

    8421_flyproblem.aep.zip


    Fahd Chishty
    Motion Design Artist
    MotionCue

  • Julie Mullins

    January 21, 2015 at 5:45 pm

    Thanks for responding!
    This is pretty much what I’m doing now. But is there any way I can parent the dash line start/stop on the stroke to the position of the fly, to follow behind the fly so I don’t have to keyframe the start/stop points on a separate layer? If that makes sense?

  • Jim Huffaker

    January 21, 2015 at 7:12 pm

    This is a backwards way to do it, but it may work for you.

    1. Create your shape layer and paste the position keyframes into the path.
    2. Make sure the position keyframes on the fly are linear.
    3. Add a Trim Path to your shape.
    4. To the fly layer’s position, add this expression:

    TRIMEND=pickwhip this part to the trim path end value;
    BEG=timeToFrames(key(1).time);
    END=timeToFrames(key(numKeys).time);
    PERCENT=linear(TRIMEND,1,100,BEG,END);
    TIME=framesToTime(PERCENT);
    RESULT=position.valueAtTime(TIME);
    RESULT

    5. Then just use keyframes however you want to get from 0 to 100 percent on your trim path. Your fly will follow (or lead, I guess).

    I’m sure the moderators could do a better job, but hopefully this helps.

    Jim

    TRIMEND=pickwhip this part to the trim path end value;
    BEG=timeToFrames(key(1).time);
    END=timeToFrames(key(numKeys).time);
    PERCENT=linear(TRIMEND,1,100,BEG,END);
    TIME=framesToTime(PERCENT);
    RESULT=position.valueAtTime(TIME);
    RESULT

  • Jason Jantzen

    January 22, 2015 at 6:50 pm

    Or you could simply create a layer with the Write-On effect and pick whip the position to the animated layer’s position. I attached an example of that.

    8426_writeon.aep.zip

    Jason Jantzen
    vimeo.com/jasonj

  • Julie Mullins

    January 22, 2015 at 7:49 pm

    Hi Jason,
    This seems like it could definitely work, but I can’t open your file 🙁
    I tried this but am doing something wrong. When I keyframe the Brush Position it just goes in a straight line. I only saw the pickwhip/parent for the entire animated layer (“Entire fly up and down” comp). I’m overlooking something here… (see attached image)

    8427_flyhuh2.jpg.zip

  • Jason Jantzen

    January 22, 2015 at 8:18 pm

    Oh you’re using something earlier than CC 2014, sorry. It’s a very easy solution. Alt-click (Option click on a mac) the Stop watch for the brush position on the write on effect. The expression window will open up and you’ll see a pick whip to the left of that window. Use THAT one to pick whip just the write-on brush property to the position property of your fly.

    Now set the effect properties on the write on effect.

    Here’s a copy of the file as well in CS6 format.

    8429_writeoncs6.aep.zip

    Jason Jantzen
    vimeo.com/jasonj

  • Julie Mullins

    January 22, 2015 at 8:52 pm

    OH! DUH!!! of course! Thank you so much! This is exactly what I needed!

  • Jim Huffaker

    February 18, 2015 at 12:43 am

    Oh yeah, I forgot Write On can do dotted lines. I recently did a much more complicated line animation that had to be done with the method I outlined, but yeah, that’s way easier. 🙂

  • Julie Mullins

    February 24, 2015 at 8:47 pm

    Of course, the client came back with a bunch of changes to the path. This method has saved me from so many headaches! Thanks again!

  • Jason Jantzen

    February 24, 2015 at 10:40 pm

    Glad it worked out for you! I love dynamic solutions like this.

    Jason Jantzen
    vimeo.com/jasonj

Page 1 of 2

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