Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions luma to drive animation of multiple comps

  • luma to drive animation of multiple comps

    Posted by Andy Acourt on May 29, 2012 at 12:19 pm

    Hi, I trying to animate the scale of an array of comps from a background fractal map. So for instance if the luma of a the section of fractal behind a particular comp was 100% white that comp’s scale would be 100%

    Thanks in advance

    Andy Acourt replied 13 years, 11 months ago 3 Members · 5 Replies
  • 5 Replies
  • Wim Bruyninckx

    May 29, 2012 at 1:07 pm

    Hi,

    not sure of this will help you but;

    I would suggest to use the nifty expression sampleImage() in the scale property layer
    of each comp you want to scale in your array :

    the expression would be:
    100*[thisComp.layer(“GreyscaleMap”).sampleImage(position)[0],thisComp.layer(“GreyscaleMap”).sampleImage(position)[0]]

    position = the position of your current comp you want to scale
    where GreyscaleMap = your fractal map…
    multiply it by 100, because sampleimage returns a value between 0 and 1.

    Kind Regards

    Wim

    graphic designer / illustrator

    https://www.flickr.com/photos/wixwix/
    https://www.wimbr.be

    Ladybugs

  • Dan Ebberts

    May 29, 2012 at 1:21 pm

    It would probably be like this:

    target = thisComp.layer(“background”);
    rgba = target.sampleImage(target.fromComp(toComp(anchorPoint)), [.5,.5], true, time);
    luma = rgbToHsl(rgba)[2];
    [luma,luma]*100

    Note that this is set up for a 1-pixel sample–you might want a larger area, depending on your setup.

    Dan

  • Andy Acourt

    May 29, 2012 at 4:24 pm

    thanks for this, unfortunately I cant get it to work and I’m sure its me.
    the fractal is on layer 1 and called “GreyscaleMap”
    the comp I want to scale is on layer 2 and called “comp”
    I’ve applied the script to scale property of the “comp” layer

    and thats where my understanding falls apart – any more help would be greatly appreciated.

    thanks

  • Wim Bruyninckx

    May 29, 2012 at 6:21 pm

    make sure you precomposed the fractal layer, otherwise it won’t work

  • Andy Acourt

    May 29, 2012 at 9:11 pm

    thanks for both of your help, especially Dan, it worked in the end. The problem was the fractal map had 3D turned on. As soon as I turned it off the script worked.

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