I'm trying to make a function that will spin a brick 360 degrees in a given amount of time. Or, an explanation in code:
function SpinBrick(Time)
--Spin the brick 360 degrees in *Time* seconds.
end
I tried making a function that calculated how much the brick needed to spin per second by dividing the circumference of its spin by Time, but I ran into another problem: How many times do I need to iterate the spin distance to reach 360 degrees? In the end, I couldn't figure it out.
How do I make a function that spins a brick 360 degrees in a given amount of time?

3 comments
Be careful; this implicitly requires that
Timebe at least 12 seconds (becausewaitcan't wait quickly enough).Is there a way to make it spin faster? For my needs, the spinner has to accelerate.
You could either set the radians increment to a higher value every interation within the loop using a variable, or by decreasing the time every interation. How you go about this really depends on the effect you want to achieve. It may be worth looking into interpolation algorithms for this purpose.