-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Davvex87 edited this page Apr 6, 2023
·
1 revision
To start using TweenStep, first, choose the method you want to add TweenStep to your project:
- Installing the TweenStep module at roblox and putting inside ReplicatedStorage
- Using the loader through adding
require(12237401000)in your code
Then open your script and add a reference to TweenStep using require, heres a quick example of the references that you'll need
local TweenStep = require(12237401000)
local StepInfo = TweenStep.StepInfoTo start Tweening, you can use the TweenStep.new() function, that will return a TweenInstance that is used to control your tween.
local Info = StepInfo.new(
3, -- The duration of the tween, in seconds
"InOutSine", -- The easing style of the tween
0, -- How much time to wait, in seconds, for the tween to start playing once the :Play() function has been called
false, -- Reverse the tween once its finished
0 -- How many times should the tween repeat
)
local Tween = TweenStep.new(
workspace.Part, -- The object/instance or table to tween
Info, -- The StepInfo
{Position = workspace.Part.Position + Vector3.new(0,10,0)}, -- The property table
true -- Run in client
)To control your tween you can use the following functions:
Tween:Play() -- Start playing the tween
Tween:Pause() -- Pauses the tween
Tween:Stop() -- Stops the tween entierly
Tween:SetTweenSpeed(1) -- Sets the tween playback speed, the Speed value is a multiplierThere are also callbacks you could use
Tween.TweenUpdated:Connect(function(durationDelta:number, tweenDelta:number) -- Fires when the tween updates
-- durationDelta is a number between 0 and 1 that determines the position of the tween
-- tweenDelta is a number, its similar to durationDelta but it determines the delta step of the EasingStyle inside the tween info
end)
Tween.Completed:Connect(function(interrupted:boolean) -- Fires when the tween stops
-- interrupted is a boolean that determines if the tween has finished playing or was interrupted, if the tween was interupted, using Tween:Stop() for example, this value will be true, otherwise false
end)