-
Notifications
You must be signed in to change notification settings - Fork 0
Usage & Examples
Davvex87 edited this page Apr 6, 2023
·
1 revision
Heres a quick example of tweening a parts position, size and color.
local TweenStep = require(12237401000)
local StepInfo = TweenStep.StepInfo
local Info = StepInfo.new(3, "InOutSine")
local Tween = TweenStep.new(workspace.Part, Info, {
Position = workspace.Part.Position + Vector3.new(0,10,0),
Size = Vector3.new(4,3,6),
Color = Color3.fromRGB(23, 166, 255) -- Red, Green, Blue. Bluish color
}, false)To tween other instances, like values for example, is the same process, however instead of using the Position, Size and Color properties, for Value Objects we can use the Value property
local TweenStep = require(12237401000)
local StepInfo = TweenStep.StepInfo
local Info = StepInfo.new(4, "InOutElastic")
local Tween = TweenStep.new(workspace.Part, Info, {Value = 20}, false)Unlike roblox's TweenService, TweenStep allows users to tween table elements, like _G for example.
local TweenStep = require(12237401000)
local StepInfo = TweenStep.StepInfo
local myTable = {
pets = {
dogs = 1,
cats = 0,
hamsters = 0,
}
}
local Info = StepInfo.new(4, "Linear")
local Tween = TweenStep.new(myTable.pets, Info, {dogs = 3, cats = 2}, false)By far my favourite thing about TweenStep is that it allows users to create their own EasingStyles. NOTE: THIS IS FOR DEVELOPERS THAT HAVE A GOOD EXPERIENCE AND MATH KNOWLEDGE!
local TweenStep = require(12237401000)
local StepInfo = TweenStep.StepInfo
TweenStep:AddCustomEasingStyle(
"Coil", -- The name of our custom EasingStyle
function(x) -- The function that will be used to calculate the easingDelta, the x is the durationDelta, between 0 and 1
x * math.cos(x * 30)
end
)
local Info = StepInfo.new(6, "Coil")
local Tween = TweenStep.new(workspace.Part, Info, {Transparency = 1}, false)