• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Weird rotation glitch when working with large numbers in expressions

New Here ,
May 21, 2021 May 21, 2021

Copy link to clipboard

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.

christianf85835723_0-1621611802011.png

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

TOPICS
Expressions

Views

158

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

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.

Votes

Translate

Translate

Report

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