Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions nearestKey from other layer

  • nearestKey from other layer

    Posted by Jano Sempere on December 19, 2014 at 7:57 pm

    Hello.

    I usually use:

    d = Math.abs(time – nearestKey(time).time);
    easeOut(d, 0, .1, 100, 0)

    Which retrieves somthing like 3 keyframes with just one. This works fine working in a layer.

    I want to use a layer reference (A), to this layer will be linked 2 solids 1 and 2.
    Solid 1 will take value information form the keyframes, as usual (Just picking with pickwhip)
    Solid 2 Just take the position of keyframe to change it’s opacity like a camera flash.

    I’ve tried many and many expressions, but I can’t solve.
    Thanks

    d = Math.abs(time - nearestKey(time).time);
    easeOut(d, 0, .1, 100, 0)

    Jano Sempere replied 11 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 20, 2014 at 12:37 am

    You didn’t mention which Layer A property you wanted to respond to, so this assumes Opacity (just change the first line if that’s not correct):

    // solid 2’s opacity expression might look like this

    prop = thisComp.layer(“Layer A”).transform.opacity;
    d = Math.abs(time – prop.nearestKey(time).time);
    easeOut(d, 0, .1, 100, 0)

    Dan

  • Jano Sempere

    December 20, 2014 at 8:28 am

    Hello Dan.

    You are a genius, and you are right, sorry, Layer A is a control layer, and the property to change is a checkbox.

    Expression works perfectly, I just modified the first line and voilá, I think I didn’t defined well the first variable and of course my expression didn’t works.

    Best regards

    Jano.

    Motiongrapher at cinestorm.es

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