Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Rotation counter

  • Posted by Frank Johnson on February 9, 2019 at 1:23 am

    It seems simple with expressions but I haven’t been able to get it to work. I need the number text to change with every rotation.

    The counter reads “0.000” at the start but when the item rotates 5 times over 10 seconds the counter reads “5.000”

    Thank you

    Frank Johnson replied 7 years, 6 months ago 4 Members · 9 Replies
  • 9 Replies
  • Andrei Popa

    February 9, 2019 at 7:37 am

    In the “Source Text” property write this expression:

    rot=thisComp.layer("Shape Layer 1")("Transform")("Rotation");//here you can pickwhip the rotation property of the layer you need to count
    Math.floor(rot/360)

    Andrei
    My Envato portfolio.

  • Frank Johnson

    February 9, 2019 at 8:59 pm

    Thank you for the reply but I’m not doing it correctly. Every time the wheel makes a revolution, I want the counter to reflect the number of rotations. I’ll keep trying. Thank you for any thoughts.

  • Dan Ebberts

    February 9, 2019 at 10:11 pm

    Your expression needs to look like this:

    rot=thisComp.layer(“FW3.tif”)(“Transform”)(“Rotation”);
    Math.floor(rot/360)

    Dan

  • Frank Johnson

    February 10, 2019 at 12:05 am

    Thank you that helped but I dont understand what happened.
    Nothing worked until i turned off the Numbers effect in the Effect Controls Panel.

    The red numbers went away but some new white one appeared. They are counting but, since I turned off the effect, I have no control over how it’s displayed. There are way too many digits and the decimal is in the wrong place.

    I don’t know why it appeared after I turned of the Numbers effect in the effects panel?

    THANKS!!!!

  • Dan Ebberts

    February 10, 2019 at 12:29 am

    I’m confused. Are you using the source text of a text layer to display the rotation count, or the Number effect?

    Dan

  • Tomas Bumbulevičius

    February 10, 2019 at 6:40 pm

    Frank,

    the Numbers effect ignores any layer’s source visuals and generates numbers solely rendered by this effect.

    However, by adding the expression provided by Dan into text’s source property, you will get the numbers accordingly. Their visuals can be adjusted through the Character panel. If you need some more customisation of numbers like trailing zeroes, etc – just let us know your specification in detail.

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.

  • Frank Johnson

    February 12, 2019 at 11:25 pm

    Thank you for all the helpful replies. You are all amazing I got it to work well enough. Although I wouldnt mind 2 decimal places.

    The gear ratio is 1: 1.32 but it rounds close enough

  • Tomas Bumbulevičius

    February 13, 2019 at 1:10 pm

    To have decimals, you don’t need to ‘floor’ the result. In general, it would be:

    num = 5.567;
    parseFloat(num).toFixed(2);

    Result would be: 5.57

    In your expression as below:

    rot=thisComp.layer("FW3.tif")("Transform")("Rotation");
    parseFloat(rot/360).toFixed(2);

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.

  • Frank Johnson

    February 14, 2019 at 4:20 am

    Amazing!

    This is for a museum so you’ve made the world a better place…
    Seriously, much thanks

    Frank

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