Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adjusting a layers’ scale based on another layers’ alpha

  • Adjusting a layers’ scale based on another layers’ alpha

    Posted by Adam Buritsch on September 19, 2011 at 6:30 pm

    The animation I’m aiming to create is a grid of small circles (all individual comps) that adjust their scale to reflect the alpha of another (Matte) layer.

    The object would be to have the circles, when masked by the other Matte layer completely, they would be scaled to 0% – and when the Matte layer is not covering the circles, they are scaled to 100%. Yet still be able to hit all the percentages in-between (as in 50% opacity = 50% scale)

    I don’t own Trapcode Form or Particular, so this has to be done the old-fashioned way.

    Thank you in advance!
    -Adam

    Jamie Shiels replied 11 years, 3 months ago 4 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    September 19, 2011 at 6:51 pm

    I think this is what you’re looking for. You might have to reverse minScale and maxScale in the last line.

    M = thisComp.layer(“Matte”);
    minScale = [0,0];
    maxScale = [100,100];
    p = M.fromComp(toComp(anchorPoint));
    a = M.sampleImage(p,[.5,.5],true,time)[3];
    linear(a,0,1,maxScale,minScale)

    Dan

  • Stefan Hinze

    September 19, 2011 at 6:57 pm

    i can not give you the complet awnser, but i can tell you how i would try.

    one:
    Epression
    maybe with some “SambleImage”

    two:
    by using “card-dance” and the currend comp as a driver

    as i am writing i think two is the better way!
    hope this helps

    greetz

  • Adam Buritsch

    September 19, 2011 at 8:08 pm

    Perfect! Thank you Dan, that was exactly the ticket!

    And Stefan, that card dance idea is a smart approach for this project. I should have thought of that, but it will most likely help me with other aspects of this same project. Thanks to you both for the helpful and prompt answers!

  • Jamie Shiels

    February 13, 2015 at 2:33 pm

    Hi Dan,

    Is it possible to use this but with a inertial bounce similar to this expression?

    Thanks

    Jamie

    // Inertial Easing (elastically reacts to the speed at which it was animated)
    amp = .1;
    freq = 2.0;
    decay = 2.0;
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n--;
    }}
    if (n == 0){ t = 0;
    }else{
    t = time - key(n).time;
    }
    if (n > 0 && t < 1){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value
    }

  • Dan Ebberts

    February 13, 2015 at 8:48 pm

    Hard to say. It depends on what’s driving the alpha change. Is it keyframes somewhere, or something else?

    Dan

  • Jamie Shiels

    February 16, 2015 at 10:47 am

    I would be using a precomp, the same size as the main comp with animated shape layers to control the scale of the objects in the main comp.

  • Dan Ebberts

    February 16, 2015 at 5:48 pm

    That makes it complicated. Somehow you have to come up with the velocity of the alpha change to drive the overshoot oscillation. Or, you could detect the alpha exceeding some threshold and use that event to trigger your scale-up animation (including the overshoot). Hard to say exactly without knowing all the details. I think it can be done, but it’s not simple.

    Dan

  • Jamie Shiels

    February 16, 2015 at 6:29 pm

    Thanks for looking into this Dan, I will find another workaround.

    Cheers

    Jamie

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