Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions alternating rotation between position keyframes

  • alternating rotation between position keyframes

  • Frank Feijen

    February 4, 2010 at 9:12 pm

    Hi there,

    I have a layers position keyframed, but now i’d like to add some degree of alternating random rotation.
    for example:
    at poskeyframe1 – rotation:+12
    at poskeyframe2 – rotation:-20
    at poskeyframe3 – rotation:+22
    at poskeyframe4 – rotation:-6

    I must admit not to have clue on how to do this. But since there will be tons of positionkeyframes, an expression would surely save my wrists.

  • Dan Ebberts

    February 4, 2010 at 9:41 pm

    This might be close:

    maxVal = 25;
    minVal = 5;
    n = 0;

    if (position.numKeys > 0){
    n = position.nearestKey(time).index;
    if (position.key(n).time > time) n–;
    if (n == 0){
    }else if (n == position.numKeys){
    a = random(minVal,maxVal);
    if (n%2) a else -1;
    a1 = random(minVal,maxVal);
    a2 = random(minVal,maxVal);
    if (n%2) a2 = -a2 else a1 = -a1;
    t1 = position.key(n).time;
    t2 = position.key(n+1).time;


  • Frank Feijen

    February 4, 2010 at 9:48 pm

    Just 1 word for you: AWESOME!!

    works perfect, thanks.

Viewing 1 - 3 of 3 posts

Log in to reply.

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