SpringService
Drop in replacement for TweenService using SmoothDamp
This is not production ready, and is a mere test. Use spr
for more features and stability.
Supported Types:
number
Vector3
CFrame
Color3
Vector2
UDim
Vector2int16
Vector3int16
UDim2
Rect
NumberSequence
ColorSequence
Examples:
Color + Position:
local SpringService = require(game.ReplicatedStorage.SpringService)
local Frame = game.Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("Frame")
local tween = SpringService:Create(Frame, {
smoothTime = 10,
maxSpeed = math.huge,
dt = 0.1,
}, {
Position = UDim2.new(1, 0, 0.5, 0),
BackgroundColor3 = Color3.fromRGB(255, 0, 0),
})
tween:Play()
NumberSequence + ColorSequence (UIGradient)
local SpringService = require(game.ReplicatedStorage.SpringService)
local Frame = game.Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("Frame")
local tween = SpringService:Create(Frame.UIGradient, {
smoothTime = 10,
maxSpeed = 1,
dt = 0.1,
}, {
Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0),
NumberSequenceKeypoint.new(1, 1),
}),
Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(128, 0, 255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 255, 128)),
}),
})
tween:Play()
Moving Block (Position + Color)
local SpringService = require(game.ReplicatedStorage.SpringService)
local tween = SpringService:Create(workspace:WaitForChild("Part"), {
smoothTime = 10,
maxSpeed = math.huge,
dt = 0.1,
}, {
Position = Vector3.new(20, 5, -30),
Color = Color3.fromRGB(255, 0, 0),
})
tween:Play()