ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Using pixel data from a target layer to drive scale.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Justin Maloney
Using pixel data from a target layer to drive scale.
on Nov 20, 2018 at 4:23:45 pm

Is there a way to link a value (like scale) to pixel data from a target layer, say, underneath the former's anchor-pointw?

I'm trying to use a ramp or blur of a solid layer sweeping across the frame to drive the scale of several smaller layers.

Here is the expression I'm using now.
/////
sampleSize = [10,10];
target = thisComp.layer("DRIVER");
samplePos = [target.width,target.height]/2;
rgb = target.sampleImage(samplePos, sampleSize, true, time);
hsl = rgbToHsl(rgb);
[hsl[2]*100,hsl[2]*100]
/////

"DRIVER" is the ramped/blurred solid.
This expression sorta works but it doesn't look very good. I actually ripped this from a thread on using pixel data to drive opacity.


Return to posts index

Dan Ebberts
Re: Using pixel data from a target layer to drive scale.
on Nov 20, 2018 at 4:42:28 pm

Try it this way:

sampleSize = [10,10];
target = thisComp.layer("DRIVER");
samplePos = target.fromComp(toComp(anchorPoint));
rgb = target.sampleImage(samplePos, sampleSize, true, time);
hsl = rgbToHsl(rgb);
[hsl[2]*100,hsl[2]*100]


Dan



Return to posts index

Justin Maloney
Re: Using pixel data from a target layer to drive scale.
on Nov 20, 2018 at 5:29:33 pm

Awesome! Thanks again Dan!


Return to posts index

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