Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Getting key frames expression value independent of each other to another property

  • Getting key frames expression value independent of each other to another property

    Posted by Tim Harris on May 7, 2012 at 7:38 am

    Hi,

    I was wondering if anyone can let me know how to only get the key frame date from one layers effect property to another where it also has an Expressions applied to it, but if there are no key frames present it will revert to using the value from the expression.
    I have tried using the – nearestKey(time) – however that only works if there is at least one key frame present.
    So is there a way to write an expression that will look to the layers property to check if there is any key frames and if so use them exclusively (such as what happens if using nearestKey(time)) or if no key frames use the expression value.
    Hope that does not sound too convoluted.

    Kind Regards,

    Tim

    Tim Harris replied 14 years ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    May 7, 2012 at 4:17 pm

    So you want to hold the value of the most recent, previous keframe until another one comes along, is that correct? I mean, you don’t care about the values between the keyframes?

    Also, what’s the expression?

    Dan

  • Tim Harris

    May 8, 2012 at 12:59 am

    Hi Dan,
    Thank you so kindly for responding to my question.
    Yes that is what I want ;-).
    I will explain what I am trying to achieve;
    I have set a sample Image expression to get the value from a depth map and then feed that to the camera blur plug in. However, I only want to send the value to the camera blur for the key frames I place, or if no key frames the value that is present. So if there are key frames it will ignore other any other values.
    In short I am trying to add the feature that is present in the Frishluft Lenscare depth of field plug in to the After Effect lens blur plug in.
    Hope that makes so kind of sense.
    Thanks once again for your time Dan.

    Kind Regards,

    Tim

  • Dan Ebberts

    May 8, 2012 at 3:30 am

    Well, in that case, I’d try something like this (you’ll need to edit the first line to point to the property with the keyframes):


    p = effect("Angle Control")("Angle"); //; property that has the keyframes
    n = 0;
    if (p.numKeys > 0){
    n = p.nearestKey(time).index;
    if (p.key(n).time > time) n--;
    }
    if (n> 0)
    p.valueAtTime(p.key(n).time)
    else
    value

    Dan

  • Tim Harris

    May 8, 2012 at 5:36 am

    Hi Dan,

    Thanks so much for your time, greatly appreciated.
    I will let you know how it goes shortly.

    Kind Regards,

    Tim

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