Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a part tween with different In and Out animations?

Asked by 5 years ago

Is it possible to make a part tween with a different In and Out animation?

Like for example like the part will have a 'Bounce Out' animation then a 'Sine In' animation

This is the original code for the tween

local TweeningService = game:GetService("TweenService")
local partChanges = {
    Position = Vector3.new(-40, 59.25, 0)
}
local TweenInformation = TweenInfo.new(
    1, -- Tween length
    Enum.EasingStyle.Bounce, -- Easing Style
    Enum.EasingDirection.Out, -- Easing Direction
    3, -- Repitition time
    true, -- Reverse?
    3 -- delay      
)
local tween = TweeningService:Create(game.Workspace.Crush,TweenInformation,partChanges)
wait(1)
tween:Play()

I tried this... But, it stills has the Bounce animation for both In and Out Directions

local TweeningService = game:GetService("TweenService")
local partChanges = {
    Position = Vector3.new(-40, 59.25, 0)
}
local TweenInformation = TweenInfo.new(
    1, -- Tween length
    Enum.EasingStyle.Bounce, -- Easing Style
    Enum.EasingDirection.Out, -- Easing Direction
    3, -- Repitition time
    true, -- Reverse?
    3, -- delay     

    1, -- Tween length
    Enum.EasingStyle.Sine,
    Enum.EasingDirection.In,
    3, 
    true,
    2   
)
local tween = TweeningService:Create(game.Workspace.Crush,TweenInformation,partChanges)
wait(1)
tween:Play()

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You're not supposed to put In and Out in a single TweenInfo.

In:

local TweeningService = game:GetService("TweenService")
local partChanges = {
    Position = Vector3.new(-40, 59.25, 0)
}
local TweenInformation = TweenInfo.new(
    1, -- Tween length
    Enum.EasingStyle.Bounce, -- Easing Style
    Enum.EasingDirection.Out, -- Easing Direction
    3, -- Repitition time
    true, -- Reverse?
    3 -- delay      
)
local tween = TweeningService:Create(game.Workspace.Crush,TweenInformation,partChanges)
wait(1)
tween:Play()

Out:

local TweeningService = game:GetService("TweenService")
local partChanges = {
    Position = Vector3.new(-40, 59.25, 0)
}
local TweenInformation = TweenInfo.new(
    1, -- Tween length
    Enum.EasingStyle.Sine, -- Easing Style
    Enum.EasingDirection.In, -- Easing Direction
    3, -- Repitition time
    true, -- Reverse?
    2 -- delay      
)
local tween = TweeningService:Create(game.Workspace.Crush,TweenInformation,partChanges)
wait(1)
tween:Play()

Combined:

local TweeningService = game:GetService("TweenService")
local partChanges = {
    Position = Vector3.new(-40, 59.25, 0)
}
local TweenInformation = TweenInfo.new(
    1, -- Tween length
    Enum.EasingStyle.Bounce, -- Easing Style
    Enum.EasingDirection.Out, -- Easing Direction
    3, -- Repitition time
    true, -- Reverse?
    3 -- delay      
)
local tween = TweeningService:Create(game.Workspace.Crush,TweenInformation,partChanges)
wait(1)
tween:Play()

TweenInformation = TweenInfo.new(
    1, -- Tween length
    Enum.EasingStyle.Sine, -- Easing Style
    Enum.EasingDirection.In, -- Easing Direction
    3, -- Repitition time
    true, -- Reverse?
    2 -- delay      
)
tween = TweeningService:Create(game.Workspace.Crush,TweenInformation,partChanges)
wait(1)
tween:Play()
Ad

Answer this question