ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Path To Position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jamie Bradshaw
Path To Position
on Apr 22, 2009 at 9:54:00 am

Hi all.

Is there any way that you can use an expression to take a Path and a percentage along it and covert it to an XY position?

Thanks,
Jamie

JimJam•Graphics
http://www.jimjamgraphics.com/


Return to posts index

Kevin Camp
Re: Path To Position
on Apr 22, 2009 at 4:07:27 pm

there probably is a way to have an expression do it, but you should be able to select your mask path (hit 'mm' on the keyboard, select the 'mask path' property), copy it, then select you position property and paste the path into the position.

you should get as many keyframes as you have points on the mask, with the first and last keyframes being locke to time and any in between being roving. so as you drag the first or last keyframes the roving keyframes will distribute accordingly...

does that help you out...?

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

Jamie Bradshaw
Re: Path To Position
on Apr 22, 2009 at 4:34:45 pm

Thanks Kevin.

Yeah I already am using that technique, but was really after an expression so that I can make the project a lot easier for other people to pick up and use.

Thanks,
Jamie

JimJam•Graphics
http://www.jimjamgraphics.com/


Return to posts index


ben rollason
Re: Path To Position
on Apr 22, 2009 at 11:12:27 pm

I don't think you can pull the mask point values straight out of a mask path. I've never heard of it anyway.

What you can do though is copy the mask path, paste it into the position attribute of a null layer (or any layer with visibility turned off). It doesn't matter where the keyframes fall in time.

Then add an expression slider to the layer you want to move along the path. I called my slider "percentage", then paste the following code into the position attribute of the same layer.


tPath = thisComp.layer("null").transform.position; //change this to the null layer you just created!
tLastFrame = tPath.key(tPath.numKeys).time;//get the time of the last keyframe
tFirstFrame = tPath.key(1).time; //get the time of the first keyframe

tPercentage = effect("percentage")("Slider")/100; //read in the value from the percentage slider
//the next line converts that percentage into a point in time between the first and last keyframe.
tPercentageAsATime = (tPercentage*(tLastFrame-tFirstFrame)) + tFirstFrame;

myPos = tPath.valueAtTime(tPercentageAsATime); //read the position at that point in time and put it into this layer's current position. Hey presto!


Now you can have multiple layers all referencing the same path, but moving along it at different times, courtesy of their percentage slider.

Hope that helps.

-Ben.

http://www.benrollason.com


Return to posts index

Jamie Bradshaw
Re: Path To Position
on Apr 23, 2009 at 9:43:04 am

Cheers Ben. This looks like it might work.

Thanks!

Jamie

JimJam•Graphics
http://www.jimjamgraphics.com/


Return to posts index

Kim Huston
Re: Path To Position
on Jun 23, 2009 at 8:26:06 pm

I used the copy mask shape properties and past into the position property technique, but it made the path much larger upon pasting than the path I actually drew. Is there a way to make it either not do that from the start, or to shrink the position keyframes down to a smaller version of the path?

The path is a spiral and I want the spiral to be tighter. Right now the spiral goes way off the composition screen.



Return to posts index

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