ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Rotation counter

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Frank Johnson
Rotation counter
on Feb 9, 2019 at 1:23:38 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


Return to posts index

Andrei Popa
Re: Rotation counter
on Feb 9, 2019 at 7:37:35 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.


Return to posts index

Frank Johnson
Re: Rotation counter
on Feb 9, 2019 at 8:59:37 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.


Return to posts index


Dan Ebberts
Re: Rotation counter
on Feb 9, 2019 at 10:11:31 pm

Your expression needs to look like this:

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


Dan



Return to posts index

Frank Johnson
Re: Rotation counter
on Feb 10, 2019 at 12:05:06 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!!!!



Return to posts index

Dan Ebberts
Re: Rotation counter
on Feb 10, 2019 at 12:29:07 am

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


Dan



Return to posts index


Tomas Bumbulevičius
Re: Rotation counter
on Feb 10, 2019 at 6:40:08 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.


Return to posts index

Frank Johnson
Re: Rotation counter
on Feb 12, 2019 at 11:25:48 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




Return to posts index

Tomas Bumbulevičius
Re: Rotation counter
on Feb 13, 2019 at 1:10:03 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.


Return to posts index


Frank Johnson
Re: Rotation counter
on Feb 14, 2019 at 4:20:58 am

Amazing!

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

Frank


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]