Hey, thanks for reading this topic. My issue is that I wanted to replicate an animation with tween-service but it did not give the expected results. So I am wondering if anyone could help me with this animation.
My code:
local TweenService = game:GetService("TweenService")
local big = script.Parent.BigCube
local small = script.Parent.SmallCube
--local TweenValue1: CFrameValue = big.TweenValue
--TweenValue1.Value = big:GetPivot()
--local TweenValue2: CFrameValue = small.TweenValue
--TweenValue2.Value = small:GetPivot()
local test = TweenInfo.new(
3, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
-3 -- DelayTime
)
--local test2 = TweenInfo.new(
-- 1.5, -- Time
-- Enum.EasingStyle.Linear, -- EasingStyle
-- Enum.EasingDirection.Out, -- EasingDirection
-- -1, -- RepeatCount (when less than zero the tween will loop indefinitely)
-- false, -- Reverses (tween will reverse once reaching it's goal)
-- -3 -- DelayTime
--)
local tween1 = TweenService:Create(big.BottomLeftFront, test, { Position = big.BottomLeftBack.Position })
local tween2 = TweenService:Create(big.BottomRightFront, test, { Position = big.BottomRightBack.Position })
local tween3 = TweenService:Create(big.TopLeftFront, test, { Position = big.TopLeftBack.Position })
local tween4 = TweenService:Create(big.TopRightFront, test, { Position = big.TopRightBack.Position })
local tween5 = TweenService:Create(small.BottomLeftFront, test, { Position = big.BottomLeftFront.Position })
local tween6 = TweenService:Create(small.BottomRightFront, test, { Position = big.BottomRightFront.Position })
local tween7 = TweenService:Create(small.TopLeftFront, test, { Position = big.TopLeftFront.Position })
local tween8 = TweenService:Create(small.TopRightFront, test, { Position = big.TopRightFront.Position })
local tween9 = TweenService:Create(big.BottomLeftBack, test, { Position = small.BottomLeftBack.Position })
local tween10 = TweenService:Create(big.BottomRightBack, test, { Position = small.BottomRightBack.Position })
local tween11 = TweenService:Create(big.TopLeftBack, test, { Position = small.TopLeftBack.Position })
local tween12 = TweenService:Create(big.TopRightBack, test, { Position = small.TopRightBack.Position })
local tween13 = TweenService:Create(small.BottomLeftBack, test, { Position = small.BottomLeftFront.Position })
local tween14 = TweenService:Create(small.BottomRightBack, test, { Position = small.BottomRightFront.Position })
local tween15 = TweenService:Create(small.TopLeftBack, test, { Position = small.TopLeftFront.Position })
local tween16 = TweenService:Create(small.TopRightBack, test, { Position = small.TopRightFront.Position })
--local tween17 = TweenService:Create(big, test2, {CFrame = big.CFrame * CFrame.Angles(0, 0, math.pi/2)})
--local tween18 = TweenService:Create(small, test2, {CFrame = small.CFrame * CFrame.Angles(0, 0, math.pi/2)})
--local tween17 = TweenService:Create(TweenValue1, test, {Value = big:GetPivot()*CFrame.Angles(0, math.pi/2, 0)})
--local tween18 = TweenService:Create(TweenValue2, test, {Value = small:GetPivot()*CFrame.Angles(0, math.pi/2, 0)})
--TweenValue1.Changed:Connect(function()
-- big:PivotTo(TweenValue1.Value)
--end)
--TweenValue2.Changed:Connect(function()
-- small:PivotTo(TweenValue2.Value)
--end)
tween1:Play()
tween2:Play()
tween3:Play()
tween4:Play()
tween5:Play()
tween6:Play()
tween7:Play()
tween8:Play()
tween9:Play()
tween10:Play()
tween11:Play()
tween12:Play()
tween13:Play()
tween14:Play()
tween15:Play()
tween16:Play()
--tween17:Play()
--tween18:Play()
The model file:
tesseract.rbxm (6.5 KB)
I’m very sorry for the bad code, it was heavily heavily rushed.
What I expected:
What I got:
https://i.gyazo.com/6a119de3493f8021f38afb0adb31fe78.gif
https://i.gyazo.com/46e07283fc30bd3d751dc5446f58f068.gif
If you look very closely, you can see that in my animation there is a tiny pause at the end of the animation before it repeats, which is not smooth like the animation I wanted to replicate.
Please feel free to let me know if you need any additional info.