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

Snap position and scale to round numbers

Community Beginner ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied

Hi all,
I'm trying to create a jsfl scirpt that changes the element by:

1. Rounding the scaleX and scaleY to a number with 2 decimal places (i.e. integer percent)

2. Rounding the position x and y to a integer number (i.e. snap to pixel)

 

I've tried round/ceil/floor/toFixed, but everytime I end up with a float number similar to .9978.

I'm aware by the JS limitations when working with float numbers, but everything is OK when trying to set up the values manually from the Animate's UI.

Does anyone know a proper solution for doing this through script?

 

Thank you very much.

Views

98

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 ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied

Hi.

 

This is actually a bug that has been happening in recent years. The Animate team has already been made aware of the issue, but so far no solution has been given.

 

You can let them know about this problem via this link:

https://www.adobe.com/products/wishform.html

 

Regards,

JC

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 Beginner ,
Jul 05, 2022 Jul 05, 2022

Copy link to clipboard

Copied

LATEST

Hi, thank you very much!

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