TweenInfoデータ型

データ型日本語解説あり

ひとことで言うと

TweenServiceで、変化にかける時間・変化のしかた・くりかえしなどを決めるデータ型です。

公式の説明(英語):Stores parameters for Class.Tween|Tweens.

使用例

行ったり来たりする床
Script置く場所:動かしたいパーツの中
local TweenService = game:GetService("TweenService")
local platform = script.Parent :: BasePart
platform.Anchored = true

local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true)
local goal = { Position = platform.Position + Vector3.new(0, 0, 20) }
local tween = TweenService:Create(platform, tweenInfo, goal)
tween:Play()

スクリプトは、Luauの型チェック(luau-lsp)で確認しています。

コンストラクター(作り方)(1)

名前と書き方説明
new
TweenInfo.new(time: number, easingStyle: EasingStyle, easingDirection: EasingDirection, repeatCount: number, reverses: bool, delayTime: number)
時間・変化のしかた(EasingStyle)・方向・くりかえしの回数・行って戻るか・待ち時間を指定して作ります。Creates a new TweenInfo from the provided parameters.

プロパティ(6)

名前と書き方説明
EasingDirection
TweenInfo.EasingDirection: EasingDirection
The direction in which the tween executes.
Time
TweenInfo.Time: number
Duration of the tween, in seconds.
DelayTime
TweenInfo.DelayTime: number
Time of delay until the tween begins, in seconds.
RepeatCount
TweenInfo.RepeatCount: number
Number of times the tween repeats.
EasingStyle
TweenInfo.EasingStyle: EasingStyle
The style in which the tween executes.
Reverses
TweenInfo.Reverses: bool
Whether or not the tween interpolates in reverse tween once the initial tween completes.

TweenInfoを使う記事

英語の説明とメンバーの一覧は、Roblox Creator Documentation(TweenInfo)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。

執筆:鈴木孝昌官公庁のWeb・システム開発を担当する現役プロジェクトマネージャー。沖縄マイクラ部 クロスウェーブで、ロブロックス(Roblox)・マインクラフト(マイクラ)・Scratchなどのプログラミングを指導。マイクラカップ沖縄代表チームを指導(第6回・第7回、第7回TBS賞)。
沖縄マイクラ部で、子どもたちにロブロックス(Roblox)やマインクラフト(マイクラ)のプログラミングを教えています。プロフィールと編集方針
Instagramで教室の様子を見る
noteで記事を読む