How would I go about tweening a GUI element in an arc?

I’m trying to tween an image in an arc as part of an effect.

How would I go about doing that? Are there any specific algorithms I can use?

(Granted, I’ve only taken up to Calculus II in college)

Since the arc you’re trying to use isn’t part of an arc from a circle, per se, you’ll have to find the closest formula to approximate the arc you’re trying to achieve.

And, since Roblox doesn’t have a built-in “tween based on a formula” function, you’ll have to essentially make one yourself, presumably by changing the position of the GUIObject to the input (presumably the x-value) and the output (presumably the y-value) of the function that represents the arc.

Since deriving a formula for an arc, rather than deriving the arc from a formula is exceptionally more time-consuming, I’d recommend reading up on arc length and other resources relating to arcs.

There’s also the chance that someone has already made a plugin or script that can do some or all of what you need done here. Checking #resources:community-resources couldn’t hurt.

Oh no no, the arc I drew was just made in paint so it’s badly made. The arc I’d like to follow is one that’s part of a circle.

This requires the use of Bézier Curves (click the DevHub link to read the article). It’s a simple concept if you are comfortable with algebra and quadratics in specific. If you want a simpler explanation, you can head on over to my tutorial, simply scroll down to “Prerequisites” and click “Quadratic Bézier Curves”.

Basically, Quadratic Bézier Curves consist of 3 points:

  • a start point (p0)
  • an end point (p2)
  • a point to control the curvature (p1)

The start and end points are where the curve…starts and ends. The third point is not in-between the two, but in a way that it forms a triangle between them. Based on that, a curve is generated. How? From the interpolation of three lines:

Bezier2

If you put the point exactly equidistant (same distance) from p0 and p2, then you’ll get a symmetric curve. More specifically, to get a circular curve. I don’t remember exactly, but if you get equal distances in such a triangle, then you’ll get an approximately circular curve.

If you want, you can even explore higher-powered Bézier Curves like cubic and more!

3 Likes