This is a script I came up with to make a gui object rotate 360° in 3rds and ease in and out each time.

local RotDirection = 5/60
local RotIncrease = 5/60
local AnimFrame = 0

while wait() do
	RotIncrease = RotIncrease+RotDirection
	script.Parent.Rotation = script.Parent.Rotation + RotIncrease
	if script.Parent.Rotation >= script.Value.Value+60 then
		RotDirection = (5/60)*(-1)
	end
	if script.Parent.Rotation >= script.Value.Value+120 then
		script.Value.Value = script.Value.Value+120
		RotDirection = 5/60
		RotIncrease = 5/60
	end
	if script.Value.Value >= 360 then
		script.Parent.Rotation = 0
		script.Value.Value = 0
	end
end

There must be a better way to ease a movement then manually calculating it, how can it be done?

2 comments

0

Sorry I didn't give code, I'm terrible with the TweenService lol