Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions rotation expression

  • rotation expression

  • jason yardley

    November 6, 2015 at 7:18 am

    I have a a arrow as a compass, I have a numbers plug in, I have pickwiped the numbers to the rotation and
    when I rotate the rotation 0n the arrow the numbers work fine 1 to 360 degrees in the clockwise rotation but as soon as I rotate the numbers anticlockwise the number go into minus which is not what I want
    can anybody give me an expression to cure this and stop going into the minus numbers

  • Piotr Wilk

    November 6, 2015 at 9:27 am

    If you want to restrict angles only to positive numbers, you can add simple math expression to your pick whipped numbers expression. Something like this:
    Math.abs(thisComp.layer(“arrow”).transform.rotation)
    where “arrow” is your layer with numbers.

    I hope it helps 🙂

    Best regards,
    Piotr.

  • jason yardley

    November 6, 2015 at 10:28 am

    I tried this
    Maths.abs (thisComp.layer)(“Type 190”).transform.rotation and didn’t work the Type 190 is the layer with the numbers plug in?

  • jason yardley

    November 6, 2015 at 10:37 am

    Where do I add this piece of expression do i make a new line and add it under the pickedwipp expression or do I replace the pickedwipp expression?

  • Piotr Wilk

    November 6, 2015 at 10:38 am

    You should put your current expression on a layer with the numbers plugin (Type 190) inside brackets of the function: Math.abs(). Your statement seems to have the closing bracket missing and additional “s” in Math name. Probably it should look like this:
    Math.abs ( thisComp.layer(“Type 190”).transform.rotation )

    Best regards,
    Piotr.

  • jason yardley

    November 6, 2015 at 10:50 am

    This is my procedureI pickwhipp the numbers value on the Type 190 layer to the Rotation on the Arrow layer a expression comes up on the Type 190 layer I paste the new expression over the old expression it doesn’t work Am i doing something wrong?

  • Piotr Wilk

    November 6, 2015 at 11:06 am

    I’ve made a quick composition and exported a screen of my setup. Look if it’s the same in yours, maybe I’ve misunderstood you somewhere… You seem to do the same as I wrote…

    Best regards,
    Piotr.

  • jason yardley

    November 6, 2015 at 11:09 am

    Yea cracked it just took a while for me to get my head around it Many thanks

  • Piotr Wilk

    November 6, 2015 at 11:15 am

    You’re welcome 🙂
    Glad to hear, the problem is solved.

    Best regards,
    Piotr.

  • Dan Ebberts

    November 6, 2015 at 8:43 pm

    I’m wondering if maybe it should be like this:

    r = thisComp.layer(“Type 190”).transform.rotation%360;
    r < 0 ? r + 360 : r

    Otherwise you’ll get different values for the same orientation, depending on whether you got there by going clockwise or counter clockwise.

    Dan

Viewing 1 - 10 of 10 posts

Log in to reply.

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