包括如何使用 TweenInfo 数据类型对 Tween 进行插值的信息。TweenInfo 数据类型包括一系列属性,可用于实现各种风格的动画效果,包括反转和循环
local default = TweenInfo.New()
local timeChanged = TweenInfo.New(0.5)
local easingStyled = TweenInfo.New(0.5, Enum.EasingStyle.Back, 0, 0, 0, false)
local easingDirected = TweenInfo.New(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 0, 0, false)
local repeated = TweenInfo.New(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 0, 4, false)
local reverses = TweenInfo.New(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 0, 4, true)
local reverses = TweenInfo.New(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 0, -1, true)
local delayed = TweenInfo.New(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 1, 4, true)
local TweenService = game:GetService("TweenService")
local part = Sandbox.New("Part")
part.Position = Vector3.New(0, 10, 0)
part.Anchored = true
part.Parent = game.Workspace
local tweenInfo = TweenInfo.New(
2,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0
-1,
true,
)
local tween = TweenService:Create(part, tweenInfo, {Position = Vector3.New(0, 30, 0)})
tween:Play()
wait(10)
tween:Cancel()