FORUMS: list search recent posts

Adding parent to scale expression?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ben Christie
Adding parent to scale expression?
on Dec 9, 2015 at 11:49:51 pm

Hey guys,

Sorry I have been having lots of questions as of late!

So I'm using the following expression to change the scale of a layer based on a background gradient (from black to white) but I also need to have that layer parented to a null that is controlling a lot of layers at once for position.

The expression works great until I parent the layer to a null and then the layer scales to 0 immediately.

Is there a way to include the parent in the following expression so it works properly?

Thanks!

sourceLayer = thisComp.layer("gradient_ramp");

sampleSize = [1,1];

samplePoint = transform.position;

colour = sourceLayer.sampleImage(sampleSize,samplePoint);

x=colour[0]*66;

[x,x]


Return to posts index


Dan Ebberts
Re: Adding parent to scale expression?
on Dec 10, 2015 at 12:34:47 am

If everything is 2D, this should work:

sourceLayer = thisComp.layer("gradient_ramp");
sampleSize = [1,1];
samplePoint = sourceLayer.fromComp(toComp(anchorPoint));
colour = sourceLayer.sampleImage(samplePoint,sampleSize);
x=colour[0]*66;
[x,x]


Dan



Return to posts index

Ben Christie
Re: Adding parent to scale expression?
on Dec 10, 2015 at 12:47:10 am

This worked perfectly. Thanks a ton!


Return to posts index

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