How can I travel along an elliptical path over time and continue to loop indefinitely?

789 Views Asked by At

The equation of an elliptical path can be defined as:

x^2 / (240/2)^2 + y^2 / (h/2)^2 = 1

Where h = a randomly generated height between 10 and 60.

And t = time in seconds elapsed.

How can I start at a specific point when t = 0, and follow along the path as t increases, looping indefinitely?

1

There are 1 best solutions below

0
On BEST ANSWER

It's actually easier than that. Position on an elliptical path over time is:

x = Math.cos(t)*w/2
y = Math.sin(t)*h/2

With w and h the width and height, respectively. Scale t as needed to get the speed you want.