Skip to main content
mart-martinlofqvist
Known Participant
March 16, 2021
Question

interpoolate 0–100 as looping ellipse

  • March 16, 2021
  • 1 reply
  • 192 views

Hi! 

 

Trying to build a rig where I have a global variable for Day / Night which goes from 0 to 100 where 0 being day and 100 being complete night. What I want to accomplish with this setup is a movement from the sun traveling in an ellipse like shape where 0 and 100 have the same position and 50 is at the lower right hand side. 

Using a Math.sin/cos setup I've managed to get close to the ellipse shape from this 0–100 input but since the input value is then going back to 0 I can't find a way to continue in the same way and not going backwards.

 

The reason for me trying to connect everything to one variable is so for plenty of layers being affected by and interpolating the exact same input so it all sticks together. 

 

Any thoughts is highly appreciated! 

This topic has been closed for replies.

1 reply

Mylenium
Legend
March 17, 2021

You could run a loop to count the cycles/ revolutions or try a modulus operator with 99.99% or something like that to force it to flip over back to where it started once it approaches 100%. Otherwise you may need to get into more complex math to stabilize your angular calculations, but without actualyl seeing it, of course nobody else can tell you something specific.

 

Mylenium

mart-martinlofqvist
Known Participant
March 17, 2021

Thanks Mylenium, 

 

I think I've approached this from the wrong angle here.... Instead of having everything being tied to the Day / Night variable I'm going to set it through the of the suns yposition. That way I can do regular keyframes for the suns movoment and then interpolate the movement in Y to 0–100 on the Day / Night variable for all other layers to use.