Hello developers, I’m trying to create my own TweenService library for test and additional feature purposes. I need to rotate a part by 360, so it should complete a full spin around itself.
I use my own library because I’m using custom eases for the animations (Created by external plugin).
When I try to lerp with orientation, it always goes for the shortest path. So logically, Z axis 0 to Z axis 360 does absolutely nothing on the part.
What am I doing wrong?
Here is the scripts:
CustomTweenService:
function EzTween:Run()
local duration = self.duration
local target = self.target
local start = self.goal[1]
local goal = self.goal[2]
local startTime = tick()
local progress
if self.t == "cframe" then
--target.CFrame = start
self.isHeart = true
self.connection = game:GetService("RunService").Heartbeat:Connect(function()
local elapsedTime = tick() - startTime
progress = elapsedTime / duration
if progress >= 1 then
progress = 1
self.isHeart = false
self.connection:Disconnect()
end
--The lerp
target.CFrame = start:Lerp(goal, self.curve:Get(progress))
end)
end
end
The localscript:
local t2 = CTween:UtilizeCFrame(1,Viewport.Part,require(script.Parent.CanSpin),{CFrame.Angles(math.rad(-90),0,0),CFrame.Angles(math.rad(-90),math.rad(300),0)})
t2:Run()
I can provide more scripts if would help.