Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Connecting movements inside of a mask to a slider

  • Kamiar Babaei

    May 1, 2021 at 5:29 pm

    UP

  • Dan Ebberts

    May 1, 2021 at 10:44 pm

    You could set up an expression for your mask path, where the height is based on the slider value. This example is more complicated than it needs to be, because I wasn’t sure whether your path goes clockwise or counter-clockwise so the expression allows for either:

    s = effect("Slider Control")("Slider");

    p = thisProperty.points();

    if (p[1][0] < p[3][0]){

    p0 = p[3] - [0,s];

    p1 = p[2] - [0,s];

    newP = [p0,p1,p[2],p[3]];

    }else{

    p0 = p[1] - [0,s];

    p3 = p[2] - [0,s];

    newP = [p0,p[1],p[2],p3];

    }

    createPath(newP,[],[],true)

  • Kamiar Babaei

    May 2, 2021 at 9:38 am

    Thank you so much for this awesome expression.

    But what i meant was the white bar inside of the mask is going to move vertically and i need the slider to acknowledge it and set a value to it between 0-100 based of the size of the mask.

    is it possible?

    thank you so much and sorry for not explaining properly what i wanted at first, i didn’t how to say it.

  • Dan Ebberts

    May 3, 2021 at 10:09 pm

    The only thing I can think of would be to use sampleImage() (with postEffect=true) in a loop, starting at the top of the range and moving down (1 pixel at a time) until you find a pixel with non-zero alpha to determine the current height of that bar. Then use that value to drive the height of the mask.

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