Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using pixel data from a target layer to drive scale.

  • Using pixel data from a target layer to drive scale.

    Posted by Justin Maloney on November 20, 2018 at 4:23 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.

    Justin Maloney replied 7 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 20, 2018 at 4:42 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

  • Justin Maloney

    November 20, 2018 at 5:29 pm

    Awesome! Thanks again Dan!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy