Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Alpha triggers animation

  • Alpha triggers animation

    Posted by Boris Wilmot on October 24, 2012 at 12:19 pm

    Hello

    I have a comp with two layers. One is a precomposed animation. The other is a layer with an animated mask shape.

    I’d like the precomp animation to start and play when the alpha of the 2nd layer is on beneath it.

    I found on this forum an expression which launches an animation when a checkbox is switched on, but I can’t get to modify it to work with the alpha detection…

    Thx

    Boris Wilmot replied 13 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 24, 2012 at 5:24 pm

    Play with this and see if it does what you want. It’s set up to drive the Time Remap property of the precomp:


    L = thisComp.layer("alpha layer");
    threshold = 0.00001;
    trig = false;
    ss = [width,height]/2;
    for (f = timeToFrames(); f >= 0; f--){
    t = framesToTime(f);
    v = L.sampleImage(L.fromComp(toComp(anchorPoint,t),t),ss,true,t)[3];
    if (trig && (v < threshold)) break;
    if (v >= threshold) trig = true;
    }
    t = trig ? time - framesToTime(f+1) : 0;

    Dan

  • Boris Wilmot

    October 25, 2012 at 7:41 am

    That’s exactly it!

    I just have to precomposed the “alpha layer” as well.

    Thanks a lot!

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