-
Notifications
You must be signed in to change notification settings - Fork 0
Others
Davvex87 edited this page Apr 6, 2023
·
2 revisions
TweenStep currently does not support tweening models as its still in the works, for now we will have to rely on making our own function for tweening models.
local TweenStep = require(12237401000)
local StepInfo = TweenStep.StepInfo
local function TweenModel(model, stepInfo, goal)
local controler = {cur = model:GetPivot()}
local Tween = TweenStep.new(controler, stepInfo, {cur = goal}, false)
Tween:Play()
Tween.TweenUpdated:Connect(function(durationDelta:number, tweenDelta:number)
model:SetPivot(controler.cur)
end)
Tween.Completed:Wait()
model:SetPivot(goal)
end
TweenModel(workspace.Model, StepInfo.new(5, "InOutSine"), workspace.Model:GetPivot() + workspace.Model:GetPivot().UpVector * 7)local TweenStep = require(12237401000)
local StepInfo = TweenStep.StepInfo
local function resizeModel(model, a)
local base = model:GetPivot().Position
for _, part in pairs(model:GetDescendants()) do
if part:IsA("BasePart") then
part.Position = base:Lerp(part.Position, a)
part.Size *= a
end
end
end
local function TweenModelSize(model, stepInfo, multiplier)
local controler = {cur = 1, old = 1}
local Tween = TweenStep.new(controler, stepInfo, {cur = multiplier}, false)
Tween:Play()
Tween.TweenUpdated:Connect(function(durationDelta:number, tweenDelta:number)
resizeModel(model, (controler.cur*(multiplier-1) + 1)/(controler.old*(multiplier-1) + 1))
controler.old = controler.cur
end)
Tween.Completed:Wait()
resizeModel(model, (multiplier*(multiplier-1) + 1)/(controler.old*(multiplier-1) + 1))
end
-- WARNING: THE SIZE MULTIPLIER IS NOT FULLY ACCURATE!
TweenModelSize(script.Parent, StepInfo.new(4, "InOutSine"), 3)