How could I make a script generate UI frames in a circular pattern?

Hi, so recently I’ve been interested in deepening my mathematical skills with programming, if that makes any sense.

I think this is fairly simple to do, but I have no clue how to start.

Basically, for learning purposes, I’m interested in making a system generate UI frames automatically, but in a circle. So basically a script draws a circle shape out of UI frames.

If anybody knows how to go about making pseudocode that does this, I’d highly appreciate it. Thanks!

1 Like

First thing that comes to mind is using cosinus and sinus. You could increase the degrees maybe by 1 every step and then get the x and y distance from the center using cos for X and sin for Y value.

So (Pseudo code):

for i in 0 to 360:
    i++
    placeGui(cos(i), sin(i))
end

Looking at this page: Trigonometric functions - Wikipedia
is usually pretty helpful since trig functions are used a lot in math regarding programming.

5 Likes