Jump to content
Sign in to follow this  
Ratbaggy

[AE] Animating along a mask from another layer.

Recommended Posts

I'm wondering if it's possible to animate an object using a mask from another layer (or the same mask copied and pasted.)

 

it's the old 3d stype arrow/line which is currently a vector line revealed with the Stroke Effect.

 

Now a decision has been made to not have a rounded end on the line ... i.e, "we need an arrow head" so my thoughts were ... since the stroke effect uses a percentage along the mask/path by rights I should be able to animate the arrow head along the path at the same percentage to get a match - with minimal effort.

 

thoughts/experiences/shout outs?

Share this post


Link to post
Share on other sites

thoughts/experiences/shout outs?

 

valueAtTime(). Simply define the first and last keyframe times as the min and max time

 

pVal=thisComp.layer("ABC").effect("Percentage")("Slider");

tMin=pVal.key(1).time;
tMax=pVal.key(numKeys).time;

pTime=(pVal,0,100,tMin,tMax);

X=transform.position.valueAtTime(pTime)[0];
Y=transform.position.valueAtTime(pTime)[1];
Z=transform.position.valueAtTime(pTime)[2];

[X,Y,Z]

 

Mylenium

Share this post


Link to post
Share on other sites

Thanks for the reply Myl.

 

I'm either confused or I haven't explained properly.

 

 

I basically want to animate a layer along the mask/path of another layer.

 

is that possible?

 

or maybe I've misunderstood the genius of the code you provided. from what I can tell it just adds a slider for me to control the percentage?

Edited by Ratbaggy

Share this post


Link to post
Share on other sites

1. Copy the Mask Path (by this I mean actually highlight the words "Mask Path" and copy it)

2. Paste that into the Position property of your rounded layer

3. You should now have one keyframe for each point of your mask, with the non-ending ones being roving keyframes.

4. Move your first and last keyframes as necessary to keep it in line with your stroke effect (this will be a whole lot easier if your stroke effect is using Linear interpolation)

 

Hope that helps. You can also copy/paste paths from Illustrator into AE to do the same thing.

 

(I'm sure Mylennium's is a better solution since it seems to give you a percentage slider, but if you just need something quick and dirty mine should do the trick)

Edited by beau+++

Share this post


Link to post
Share on other sites

or maybe I've misunderstood the genius of the code you provided. from what I can tell it just adds a slider for me to control the percentage?

 

You can't access mask data with expressions, you have to copy&paste it as a position property. I assumed you already knew that.. Sorry if that got confusing.

 

Mylenium

Share this post


Link to post
Share on other sites

valueAtTime(). Simply define the first and last keyframe times as the min and max time

 

pVal=thisComp.layer("ABC").effect("Percentage")("Slider");

tMin=pVal.key(1).time;
tMax=pVal.key(numKeys).time;

pTime=(pVal,0,100,tMin,tMax);

X=transform.position.valueAtTime(pTime)[0];
Y=transform.position.valueAtTime(pTime)[1];
Z=transform.position.valueAtTime(pTime)[2];

[X,Y,Z]

 

Mylenium

 

Huh. Cool. Kinda like separating the path from the animation, like in a 3D app. Thanks!

Share this post


Link to post
Share on other sites

You can't access mask data with expressions, you have to copy&paste it as a position property. I assumed you already knew that.. Sorry if that got confusing.

 

Mylenium

 

 

SWEET!

 

Didn't know that. Thanks all.

 

Seems like this will be the way to go.

Share this post


Link to post
Share on other sites

SWEET!

 

Didn't know that. Thanks all.

 

Seems like this will be the way to go.

 

 

D'oh is it possible to scale a range of keys? ... the original layer that the path is getting copied from is 112% wide - don't ask me why - so when the keys are pasted onto the "arrow head" layer they're out of whack.

Share this post


Link to post
Share on other sites

D'oh is it possible to scale a range of keys? ... the original layer that the path is getting copied from is 112% wide - don't ask me why - so when the keys are pasted onto the "arrow head" layer they're out of whack.

 

 

also is it right to put the expression on the arrowhead layer?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...