Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Rotation Expression keyframes need to be removed

  • Rotation Expression keyframes need to be removed

    Posted by Kelvin Chong on July 1, 2013 at 2:27 am

    So I tried searching the entire net for an answer and could not find it.

    What I’m trying to do is come up with a script. Let me explain that

    Imagine a clock with the 12 hours marker only.
    I have a master layer (a line) that I animated the rotation (full 360)
    Then I want to have an expression that will automatically as I duplicate layers to divide the angles and stop them equally but still rotate the initial degrees

    I’m sure I’m not making sense, let me try that again.

    Assume there is layer 1 that rotates 360deg of a clock.
    Then suppose I have 3 other layers that I want them to rotate together with the first layer but they will stop their rotation in such a way that the angle between them is equal. I’m putting the code here.

    As of now, it works only if all the layers are animated. I want to be able to remove the keyframes from the other layers. Is that possible?

    I’m just starting expressions so this might be very rudimentary.

    test=(360/thisComp.numLayers)
    if (rotation < test*(index-1)){
    value
    }else{
    test*(index-1)
    }

    Kelvin Chong replied 12 years, 10 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 1, 2013 at 4:09 am

    I think you were close:

    test=(360/thisComp.numLayers);
    if (rotation < test*(index)){
    value
    }else{
    test*(index-1)
    }

    Dan

  • Kelvin Chong

    July 1, 2013 at 4:56 am

    Hi Dan, thanks for the reply but the code you gave me does not work properly,

    I have 3 layers now,
    one is the master which I animated rotation 1 full revolution.
    Then I duplicated the layer and added the expression I did so that no matter how much I duplicated it would always divide the angles between them equally and still rotate until that degree.

    But all the slave layer still have the keyframe animation to it, which I wanted to know if it was possible to remove?

    https://imgur.com/pNtmJaJ
    It’s a picture of what I’m trying to do.

    View post on imgur.com

  • Dan Ebberts

    July 1, 2013 at 5:38 am

    If layer 1 is your master, then the others shouldn’t need the keyrames with this:

    test=(360/thisComp.numLayers);
    r = thisComp.layer(1).rotation;
    if (r < test*(index-1)){
    r
    }else{
    test*(index-1)
    }

    Dan

  • Kelvin Chong

    July 1, 2013 at 5:52 am

    Awesome it worked 😀
    I guess that’s why you are so famous Dan,
    Thanks a lot

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