Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions RGBA to sldier values using sample image

  • RGBA to sldier values using sample image

    Posted by Craig Hellen on February 5, 2015 at 12:46 pm

    Hi Guys

    Been bashing my head against a few proverbial brick walls whilst searching these forums on an expression I need.

    Basically I want to take the Hue and alpha values of a solid with the advanced lightning effect applied to effect 4 sliders (luminocity, and R,G,B)

    I think sampleimage is the way to go but its not quite working.

    Any ideas would be appreciated!

    Thanks and POWER TO THE COW!

    Co-Director Podchains Ltd
    Video Producer / Motion graphics designer https://bexmedia.net

    Steve Brown replied 11 years, 2 months ago 2 Members · 1 Reply
  • 1 Reply
  • Steve Brown

    February 7, 2015 at 7:50 am

    Hi Craig, try this. It will sample the Lightning layer, using the current position of the layer that you apply the sliders (and the expressions) to:

    //red slider
    target = thisComp.layer("Lightning Layer");
    colorValue = target.sampleImage(transform.position, radius = [.5, .5] );
    outputValue = (colorValue * 255);
    outputValue[0];

    //green slider
    target = thisComp.layer("Lightning Layer");
    colorValue = target.sampleImage(transform.position, radius = [.5, .5] );
    outputValue = (colorValue * 255);
    outputValue[1];

    //blue slider
    target = thisComp.layer("Lightning Layer");
    colorValue = target.sampleImage(transform.position, radius = [.5, .5] );
    outputValue = (colorValue * 255);
    outputValue[2];

    //alpha slider
    target = thisComp.layer("Lightning Layer");
    colorValue = target.sampleImage(transform.position, radius = [.5, .5] );
    outputValue = (colorValue * 255);
    outputValue[3];

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