Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Parent expression using Layer control effect

  • Dan Ebberts

    June 22, 2010 at 10:08 am

    Probably something like this then:


    target = effect("Layer Control")("Layer").position; //select which layes it will follow
    seedRandom(index, true);
    delay = random(effect("Slider Control")("Slider"));
    delta = target.valueAtTime(time - delay) - target.valueAtTime(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){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + delta + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value + delta
    }

    Dan

  • Neil Stubbings

    June 22, 2010 at 10:18 am

    Hi Dan

    Thanks so much for looking into this!
    Buuuut, unfortunately it does not seem to work (i’ve gotten this far by myself before 🙂

    the layer with the expression follows the leader layer, but has no springy motion to it.
    Is it because the expression needs keyframes on its layer in order to calculate the springy motion?


    Neil Stubbings
    Graphic Design | Motion Graphics
    https://www.stubbings.ch

  • Dan Ebberts

    June 22, 2010 at 10:23 am

    Yup. That’s what I meant when I asked about what was supposed to trigger the springy motion. The way you have it set up now, it would be keyframes on the property with the expression.

    Dan

  • Dan Ebberts

    June 22, 2010 at 4:55 pm

    This might be closer to what you’re looking for. It’s triggered by the keyframes of the leader:


    target = effect("Layer Control")("Layer").position; //select which layes it will follow
    seedRandom(index, true);
    delay = random(effect("Slider Control")("Slider"));
    delta = target.valueAtTime(time - delay) - target.valueAtTime(0);

    n = 0;
    if (target.numKeys > 0){
    n = target.nearestKey(time-delay).index;
    if (target.key(n).time > time-delay){
    n--;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time - delay - target.key(n).time;
    }

    if (n > 0){
    v = target.velocityAtTime(target.key(n).time - thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + delta + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value + delta
    }

    Dan

  • Neil Stubbings

    June 22, 2010 at 6:21 pm

    oh wow!

    it works great! this is exactly what I was looking for!

    thanks a lot, Dan!


    Neil Stubbings
    Graphic Design | Motion Graphics
    https://www.stubbings.ch

Page 2 of 2

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