How can I define a percentage from another percentage between a specific interval

53 Views Asked by At

I have a cube that rotates. When the rotation is at 45 degrees I need to scale the cube to 90% of its size.

My struggle here is to calculate the amount of percentage to scale the cube according to the rotation angle. Until it is half way the scale continuously decreases to 90%, after half way rotation it needs to start increasing to 100%.

How can I calculate this?

1

There are 1 best solutions below

2
On BEST ANSWER

This function should do the job $$S(x) = 0.9 + \frac{\lvert 45 - x \pmod {90}\rvert}{450}$$ where $S(x)$ is the scaling factor and $x$ is the angle.