Tween

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

オブジェクト Tween は、インタープレーションの再生を制御します。 Tween を作成および設定するには、TweenService:Create() 機能を使用します。 2>Datatype.Instance.new()2> はこの特定のオブジェクトには使用できません。

注:配置された後、tween の構成を変更することはできません。新しい目標が必要な場合は、新しい Tween が作成される必要があります。

また、複数のツイーンが同じオブジェクトで同時にプレイされることに注意してくださいが、同じプロパティをインターポリングしてはなりません。2人のツイーンが同じプロパティを変更しようとした場合、最初のツイーンはキャンセルされ、最新のツイーンに上書きされます。

コードサンプル

In this example a Tween is created to animate the position and color of a Part. Because the position and color are part of the same tween, they will change at the exact same rate and will reach their goal at the same time.

Tween Creation

local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.new(1, 0, 0)
part.Anchored = true
part.Parent = game.Workspace
local goal = {}
goal.Position = Vector3.new(10, 10, 0)
goal.Color = Color3.new(0, 1, 0)
local tweenInfo = TweenInfo.new(5)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()

概要

プロパティ

  • 読み取り専用
    複製されていません
    並列読み取り

    読み取りのみのプロパティで、Instance のプロパティが tween によってインターポリングされています。

  • 読み取り専用
    複製されていません
    並列読み取り

    Class.Tween のインタープレーション方法に関する情報を含む読み取りのみのプロパティ。

TweenBase から継承した プロパティ
  • 読み取り専用
    複製されていません
    並列読み取り

    Class.Tween アニメーションの現在の状態を表示する読み取り専用プロパティ。

方法

TweenBase から継承した 方法
  • Cancel():void

    再生を停止し、tween 変数をリセットします。如果 then call TweenBase:Play()、tween のプロパティは、その目的地にインターポリングされるプレイバーを再生するが、アニメーションの長さを完全に取得するためには、Class.TweenBase:Play を完了する必要があります。

  • Pause():void

    押し停めると、tween のプレイを停止します。進行状況変数をリセットしないので、TweenBase:Play() を呼び出すと、tween はプレイを再開します。

  • Play():void

    汽笛のプレイを開始します。汽笛のプレイがすでに開始されている場合、Play() を呼び出すと、汽笛が完了したか、または停止したかを確認するまで効果がありません(TweenBase:Cancel() またはTweenBase:Pause() によって)。

イベント

TweenBase から継承した イベント

プロパティ

Instance

読み取り専用
複製されていません
並列読み取り

Tween のプロパティの Tween は、インターポール中のプロパティの持ち主です。

コードサンプル

This code sample includes a simple function that will return true if the instance of a tween is a Part.

Tween Instance

local TweenService = game:GetService("TweenService")
local function isInstanceAPart(tween)
local instance = tween.Instance
return instance:IsA("BasePart")
end
local tweenInfo = TweenInfo.new()
local instance = Instance.new("Part")
local tween = TweenService:Create(instance, tweenInfo, {
Transparency = 1,
})
print(isInstanceAPart(tween))

TweenInfo

読み取り専用
複製されていません
並列読み取り

Class.Tween のインタープレーションを実行するための情報を含む、読み取りのみのプロパティ。TweenInfo データタイプを使用しています。

コードサンプル

An example of the range of different interpolation effects that can be used in Tweens.

TweenInfo Examples

-- A TweenInfo with all default parameters
TweenInfo.new()
-- A TweenInfo with its time set to 0.5 seconds.
TweenInfo.new(0.5)
-- A TweenInfo with its easing style set to Back.
TweenInfo.new(0.5, Enum.EasingStyle.Back)
-- A TweenInfo with its easing direction set to In.
TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In)
-- A TweenInfo that repeats itself 4 times.
TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 4)
-- A TweenInfo that reverses its interpolation after reaching its goal.
TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 4, true)
-- A TweenInfo that loops indefinitely.
TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, -1, true)
-- A TweenInfo with a delay of 1 second between each interpolation.
TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In, 4, true, 1)

方法

イベント