Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions inspecting the type of key interpolation

  • inspecting the type of key interpolation

    Posted by Nick Hill on September 23, 2010 at 2:22 pm

    Just wanted to check, there’s no way in expressions to determine the type of a specified key, is there?

    For example:


    //
    // Designed to go in a sourceText property as a debugger
    //
    p = transform.position;

    n = 0;

    if (p.numKeys > 0) {
    n = p.nearestKey(time).index;
    if (time < p.key(n).time ) {
    // key n is ahead of us
    n--;
    }
    }

    if (p.numKeys > n && n > 0) {
    // there's at least one key after this one, and we're not before the first key

    q = p.key(n).typeOf;

    if (q == 'linear') {
    // do something
    }

    if (q == 'bezier') {
    // do something else
    }
    } else {
    // outside the current range of keys
    }

    Kevin Camp replied 15 years, 7 months ago 4 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    September 23, 2010 at 2:44 pm

    I don’t know of any way to do that.

    Dan

  • Nick Hill

    September 23, 2010 at 2:48 pm

    In that case, I doubt there is!

    Cheers 🙂

  • Chris Wright

    September 23, 2010 at 8:42 pm

    valueAtTime would know what’s going on on each key right?

    https://technicolorsoftware.hostzi.com/

  • Kevin Camp

    September 23, 2010 at 9:02 pm

    and you could use the difference of valueAtTime and valueAtTime on frame prior compared to the difference of valueAtTime for key1 and key2 divided by the frames separating those keys to determine if the interpolation was linear or not…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    September 28, 2010 at 9:23 pm

    i actually just had the need to do this, and what i used was:

    if (speedAtTime(key(2).time)==0){
    // it’s soft interpolation
    }else{
    // it’s hard interpolation
    }

    obviously, key(2) could be whatever key you needed to look at. and i assume it would work for velocityAtTime() also…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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