Function for obtaining X / Y coordinates for moving along a triangle with soft edges

I want to make an animation in javascript where an object moves along a path. To do this, I need a function that returns me the X / Y coordinates on the path for a given time. The path should be a triangle with soft edges.

At the beginning of the animation, it should move gently into the path of the triangle - but I could solve this, perhaps in another function. More important to me is a function that can return me the X / Y coordinates for moving around a triangle.

Then the animation should be infinite in the way of the triangle.

the animation path

Are there (online) tools for creating coordinates for such an animation?

Can someone help me with the function?

+5
source share
1

sqrt (x² + y²) = 2.5 + sin (atan2 (y, x) * 3)/5 - : ρ (θ) = 2.5 + sin (3θ)/5. (3 ) :

θ(t) = t // angle
ρ(t) = 2.5 + 0.2 * sin (t * 3) // radius
// of course, you can play with the parameters :-)

.

, , , . , - : ρ (θ) = 2.5 * sin (3θ)

+1

All Articles