Empty
Empty
Empty
TweenService は、Roblox で GUI エレメント、パーツ、その他のオブジェクトに滑らかなアニメーションを作成できるサービスです。オブジェクトのプロパティを指定された期間内である状態から別の状態に補間します。
トゥイーン | トゥイーンとは、オブジェクトのプロパティを開始状態から終了状態に補間するアニメーションです。 |
TweenInfo | トゥイーンの持続時間、イージングスタイル、イージング方向、繰り返し回数などのパラメータを定義します。 |
イージングスタイルと方向 | イージングスタイルは、トゥイーンの開始値と終了値を補間するために使用される数学的関数を定義します。イージング方向は、トゥイーンが開始値と終了値に対してどのように進行するかを定義します。 |
トゥイーン可能なオブジェクト
Empty
Empty
Empty
Position | パーツ/モデルを新しい場所に移動します。 |
Size | パーツ/モデルのサイズを変更します。 |
Orientation | パーツ/モデルを回転させます。 |
Transparency | パーツ/モデルの透明度を調整します。 |
Color | パーツ/モデルの色を変更します。 |
Empty
Empty
Empty
Position | パーツ/モデルを新しい場所に移動します。 |
Size | パーツ/モデルのサイズを変更します。 |
BackgroundColor3 | GUI エレメントの背景色を変更します。 |
Transparency | パーツ/モデルの透明度を調整します。 |
Empty
Empty
Empty
Brightness | 光源の明るさを調整します。 |
Color | パーツ/モデルの色を変更します。 |
Range | 光源の範囲を変更します。 |
Empty
Empty
Empty
CFrame | カメラを移動または回転させます。 |
Empty
Empty
Empty
Volume | サウンドの音量を調整します。 |
PlaybackSpeed | サウンドの再生速度を変更します。 |
TweenService の例
位置のトゥイーン
local TweenService = game:GetService("TweenService")
-- Define TweenInfo
local tweenInfo = TweenInfo.new(
2, -- Time (seconds)
Enum.EasingStyle.Quad, -- Easing Style
Enum.EasingDirection.Out, -- Easing Direction
0, -- Repeat count (0 means no repeat)
false, -- Reverses (tween goes back and forth)
0 -- Delay time (seconds)
)
local part = script.Parent
part.Position = Vector3.new(0, 2.5, 0)
part.Anchored = true
part.Parent = workspace
-- Define the end state of the properties you want to tween
local goal = {}
goal.Position = Vector3.new(10, 5, 0)
-- Create the tween
local tween = TweenService:Create(part, tweenInfo, goal)
-- Play the tween
tween:Play()
Roblox Studio
GUI エレメントのトゥイーン
local TweenService = game:GetService("TweenService")
-- Define TweenInfo
local tweenInfo = TweenInfo.new(
2, -- Time (seconds)
Enum.EasingStyle.Quad, -- Easing Style
Enum.EasingDirection.Out, -- Easing Direction
0, -- Repeat count (0 means no repeat)
false, -- Reverses (tween goes back and forth)
0 -- Delay time (seconds)
)
local part = script.Parent
part.Position = Vector3.new(0, 2.5, 0)
part.Anchored = true
part.Parent = workspace
-- Define the end state of the properties you want to tween
local goal = {}
goal.Position = Vector3.new(10, 5, 0)
-- Create the tween
local tween = TweenService:Create(part, tweenInfo, goal)
-- Play the tween
tween:Play()
Roblox Studio
光源プロパティのトゥイーン
local TweenService = game:GetService("TweenService")
-- Define TweenInfo
local tweenInfo = TweenInfo.new(
2, -- Time (seconds)
Enum.EasingStyle.Quad, -- Easing Style
Enum.EasingDirection.Out, -- Easing Direction
0, -- Repeat count (0 means no repeat)
false, -- Reverses (tween goes back and forth)
0 -- Delay time (seconds)
)
local part = script.Parent
part.Position = Vector3.new(0, 2.5, 0)
part.Anchored = true
part.Parent = workspace
-- Define the end state of the properties you want to tween
local goal = {}
goal.Position = Vector3.new(10, 5, 0)
-- Create the tween
local tween = TweenService:Create(part, tweenInfo, goal)
-- Play the tween
tween:Play()
Roblox Studio
イージングスタイル
Empty
Empty
Empty
Linear | 開始から終了まで一定速度で移動します。 |
Sine | 滑らかで周期的な運動を実現するために正弦波を使用します。 |
Back | 終了値を一度超えた後に戻ります。 |
Quad | すばやく加速し、その後減速します。 |
Cubic | Quad と似ていますが、加速と減速がより強力です。 |
Quart | Cubic よりもさらに強力な加速と減速です。 |
Quint | 最も強力な加速と減速です。 |
Bounce | 終了時にバウンドする効果を模倣します。 |
Elastic | 終了値を超えてバネのように動きます。 |
Exponential | ゆっくりと始まり、指数関数的に加速します。 |
Empty
Empty
Empty
In | トゥイーンがゆっくり始まり、終了に向かってスピードアップします。 |
Out | トゥイーンが素早く始まり、終了に向かって減速します。 |
InOut | 「In」と「Out」を組み合わせたもので、最初はゆっくり、途中で加速し、終了に向かって再び減速します。 |