Skip to main content
Participant
March 1, 2023
Question

Stepped transitions using round values only

  • March 1, 2023
  • 2 replies
  • 601 views

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

This topic has been closed for replies.

2 replies

Community Expert
March 1, 2023

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.

Dan Ebberts
Community Expert
Community Expert
March 1, 2023

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.

 

 

 

 

Participant
March 1, 2023

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

Ok thank you very much.

 

Dan Ebberts
Community Expert
Community Expert
March 1, 2023

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