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

Stepped transitions using round values only

New Here ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

Hello, I am tweening one property between two key points, and I'd like to use just integer rounded values for changing values and not also decimals. While the default behavior of the transitions is smooth, I'd like to make it in clearly visible steps.

 

Thank you very much

TOPICS
Expressions , How to

Views

411

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 ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

I guess that would be

Math.round(value)

for one-dimensional properties

[Math.round(value[0]),Math.round(value[1])]

for two-dimensional properties, etc.

 

 

 

 

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
New Here ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

Sorry for my unfamiliarity, how would I use this expression when animating, per example, the opacity of an object?

Ok 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
Community Expert ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

LATEST

You'd apply it (the one-dimensional version) to the keyframed opacity property, but I'm not sure it's going to give you discrete steps you're envisioning. You might want something more like this:

Math.floor(value/10)*10

 

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 ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

Are you trying to get a stepping action between two keyframes? For example, zero opacity at the start of a layer, then 100% at 4 seconds, but you want the opacity to change to 25% at 1 second 50% at 2, then 75% at 3, you could round the time value so time would always be a whole number, then multiply that number by 25. Something like this:

t = time - inPoint;
v = Math.floor(t);
v * 25

It would help if we knew exactly what you were trying to accomplish.

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