ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression for stroke following a motion path?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Julie Mullins
Expression for stroke following a motion path?
on Jan 20, 2015 at 3:55: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.



Return to posts index

Fahd Chishty
Re: Expression for stroke following a motion path?
on Jan 20, 2015 at 8:20:53 pm
Last Edited By Fahd Chishty on Jan 20, 2015 at 9:35:10 pm

Look at the explanation of "Create a motion path from a mask, shape, or paint path" on this site: http://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


Return to posts index

Julie Mullins
Re: Expression for stroke following a motion path?
on Jan 21, 2015 at 5:45:22 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?


Return to posts index


Jim Huffaker
Re: Expression for stroke following a motion path?
on Jan 21, 2015 at 7:12:35 pm
Last Edited By Jim Huffaker on Jan 21, 2015 at 7:18:54 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


Return to posts index

Jason Jantzen
Re: Expression for stroke following a motion path?
on Jan 22, 2015 at 6:50:56 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


Return to posts index

Julie Mullins
Re: Expression for stroke following a motion path?
on Jan 22, 2015 at 7:49:03 pm
Last Edited By Julie Mullins on Jan 22, 2015 at 7:54:55 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


Return to posts index


Jason Jantzen
Re: Expression for stroke following a motion path?
on Jan 22, 2015 at 8:18:25 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


Return to posts index

Julie Mullins
Re: Expression for stroke following a motion path?
on Jan 22, 2015 at 8:52:54 pm

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


Return to posts index

Jim Huffaker
Re: Expression for stroke following a motion path?
on Feb 18, 2015 at 12:43:33 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. :)


Return to posts index


Julie Mullins
Re: Expression for stroke following a motion path?
on Feb 24, 2015 at 8:47:13 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!


Return to posts index

Jason Jantzen
Re: Expression for stroke following a motion path?
on Feb 24, 2015 at 10:40:44 pm

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

Jason Jantzen
vimeo.com/jasonj


Return to posts index

Julie Mullins
Re: Expression for stroke following a motion path?
on Sep 25, 2015 at 9:45:07 pm

Hi!

I'm doing something similar, but I want the write-on effect not to start immediately. Here's a screen shot showing the diagonal line where the pencil comes onto the screen, but I want it to only start writing on where it is going in a circle. If I shorten the Write On adjustment layer, the diagonal line still pops on once the playhead gets to that layer. Is there an easy way to fix this?



Return to posts index

Jason Jantzen
Re: Expression for stroke following a motion path?
on Sep 25, 2015 at 10:42:37 pm

It's going to follow the position of whatever it's linked to. I'm sure someone smarter could think of a way to delay that, but if I wanted to do what you're talking about, I'd animate the pencil, then copy the position keyframes to the Write-On effect brush position. You'll probably have to line it up with the pencil tip or where you want it, then offset the keyframes enough so that it starts after the pencil. You may have to delete some of the keyframes so that the Write-On effect isn't drawing them where you don't want them.

That's a very manual way around it. I recently bought Speed Lines on AEscripts which does what you want here with so much more control.

Jason Jantzen
vimeo.com/jasonj


Return to posts index

Victor Carlier
Re: Expression for stroke following a motion path?
on Sep 28, 2015 at 11:46:45 am
Last Edited By Victor Carlier on Sep 28, 2015 at 3:36:50 pm

Hi,

you dont have to shorten your adjustment layer but just move it so the inpoint is later.

Cheers


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]