Activity › Forums › Adobe After Effects Expressions › rotation expression
-
rotation expression
Posted by Jason Yardley on November 6, 2015 at 7:18 amI 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 numbersDan Ebberts replied 10 years, 6 months ago 3 Members · 9 Replies -
9 Replies
-
Piotr Wilk
November 6, 2015 at 9:27 amIf 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 amI 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 amWhere 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 amYou 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 amThis 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 -
Jason Yardley
November 6, 2015 at 11:09 amYea cracked it just took a while for me to get my head around it Many thanks
-
Piotr Wilk
November 6, 2015 at 11:15 amYou’re welcome 🙂
Glad to hear, the problem is solved.Best regards,
Piotr. -
Dan Ebberts
November 6, 2015 at 8:43 pmI’m wondering if maybe it should be like this:
r = thisComp.layer(“Type 190”).transform.rotation%360;
r < 0 ? r + 360 : rOtherwise you’ll get different values for the same orientation, depending on whether you got there by going clockwise or counter clockwise.
Dan
Reply to this Discussion! Login or Sign Up
