## Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.

• Weird rotation glitch when working with large numb...

# Weird rotation glitch when working with large numbers in expressions

New Here ,
May 21, 2021 May 21, 2021

Copied

I tried to do a Odometer, unfortunately I get weird errors when working with large numbers.
Im sure im missing something. Tried different approaches, i.e. converting from radians to degree ("wheel"  layer) or straightup multiplying a number by 36 for the correct degree value. (all the other wheel [1..5] - layers)
Both wont work.

Attached in a zip is the project file.
with the error first occuring at 911 (no pun).
Use "_variable" to get the odometer moving.

preview of the error.
Can you pls help me with this ? 🙂

TOPICS
Expressions

Views

89

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
2 Replies 2
New Here ,
May 21, 2021 May 21, 2021

Copied

Heres the project file in case you cant see my attachment: https://we.tl/t-zocuOULBKJ

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 21, 2021 May 21, 2021

Copied

LATEST

You are running into the Javascript problem with decimal places. A much easier approach would be to just add these expressions to the CC Cylinder Effect, then animate the rotation of the bottom layer's Y Rotatioin. You could use a multiplier or value plus.

``````// CC Cylinder Position X:
src=thisComp.layer(index + 1).effect("CC Cylinder")("Position X");
ofst = 100;
src - ofst

// CC Cylinder Rotation Y;
src=thisComp.layer(index + 1).effect("CC Cylinder")("Rotation Y");
Math.floor(src / 360) * 36

``````

These two expressions move the cylincer above 100 pixels to the left and advance the rotation of Y by 36º for every rotation of the bottom layer.

You could then simply use something as simple as loopOut("continue")  to spin the right digits at 10 or even 100 times the speed of rotation for column 2, then have all of the other columns follow layer 2.

If you want to get really fancy you could use a linear or ease function to have the next column to the left ease to the next digit. You don't need to tie the slider to every layer. You only have to animate the rotation of the first digit on the right.

To completely clean up your project you'll need to get the pre-comp fixed so the 0 is exactly at comp center and work out the spacing or offset the rotation by 15º on the master layer.

Here's the modified comp. If I get time I'll fix the pre-comp so things always line up.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources
Troubleshooting FAQs
After Effects Community Recap
Getting started with After Effects