Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling shape opacity with an expression

  • Controlling shape opacity with an expression

    Posted by Neal Strydom on October 8, 2018 at 8:45 am

    Hi guys.

    I’m busy with an animation for a client, that relies heavily upon the expression for sampleImage()
    I’m using the expression on Evan Abrams’ youtube, where the shape’s size or scale is connected to a control layer via the following expression:

    sourceLayer = thisComp.layer(“gradientControlLayer_comp”);
    sampleSize = [1,1];
    samplePoint = transform.position;
    colour= sourceLayer.sampleImage(samplePoint,sampleSize);
    x=colour[0]*16;
    [x,x]

    Now I want to see what the possibility would be, to link this to an opacity property, instead of a size or scale.
    I tried adjusting the expression myself, but failed horribly and I would like to ask if any of you would be bale to assist me?

    The core of this enables me to control the shape of multiple objects, using a gradient animation in a comp as a control layer. I would like to do the same for opacity, if that is possible ?

    Thanks!
    Neal

    sourceLayer = thisComp.layer("gradientControlLayer_comp");
    sampleSize = [1,1];
    samplePoint = transform.position;
    colour= sourceLayer.sampleImage(samplePoint,sampleSize);
    x=colour[0]*16;
    [x,x]

    Dan Ebberts replied 7 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    October 8, 2018 at 1:09 pm

    Try replacing the last two lines with this:

    colour[0]*100

    Dan

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