TweenService

TweenService는 Roblox에서 GUI 요소, 부품 및 기타 객체에 부드러운 애니메이션을 생성할 수 있게 해주는 서비스입니다. 이 서비스는 객체의 속성을 특정 기간 동안 한 상태에서 다른 상태로 보간하는 데 사용됩니다.

Tween트윈은 객체의 속성을 시작 상태에서 종료 상태로 보간하는 애니메이션입니다.
TweenInfo이것은 트윈의 매개변수를 정의합니다. 예를 들어, 지속 시간, 이징 스타일, 이징 방향 및 반복 횟수 등을 포함합니다.
이징 스타일 및 방향이징 스타일은 트윈의 시작 값과 끝 값 사이를 보간하는 데 사용되는 수학적 함수를 정의합니다. 이징 방향은 트윈이 시작 값과 끝 값에 대해 어떻게 진행되는지를 정의합니다.

트윈 가능한 객체

Position부품/모델을 새로운 위치로 이동합니다.
Size부품/모델의 크기를 변경합니다.
Orientation부품/모델을 회전시킵니다.
Transparency부품/모델의 투명도를 조절합니다.
Color부품/모델의 색상을 변경합니다.
Position부품/모델을 새로운 위치로 이동합니다.
Size부품/모델의 크기를 변경합니다.
BackgroundColor3GUI 요소의 배경색을 변경합니다.
Transparency부품/모델의 투명도를 조절합니다.
Brightness광원의 밝기를 조절합니다.
Color부품/모델의 색상을 변경합니다.
Range광원의 범위를 변경합니다.
CFrame카메라를 이동하거나 회전시킵니다.
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()
Image 1
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()
Image 1
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()
Image 1
Roblox Studio

이징 스타일

Linear시작에서 끝까지 일정한 속도로 이동합니다.
Sine부드럽고 주기적인 움직임을 위해 사인파를 사용합니다.
Back끝 값을 초과하여 진행한 후 다시 돌아옵니다.
Quad빠르게 가속하고 이후 점차적으로 감속합니다.
CubicQuad와 유사하지만 더 강한 가속 및 감속 효과를 가집니다.
QuartCubic보다 더 강한 가속 및 감속 효과를 가집니다.
Quint가장 강한 가속 및 감속 효과를 가집니다.
Bounce끝에서 튀는 효과를 모방합니다.
Elastic스프링처럼 끝 값을 초과하여 움직입니다.
Exponential처음에는 천천히 시작하여 기하급수적으로 가속됩니다.
In트윈이 천천히 시작하여 끝으로 갈수록 가속됩니다.
Out트윈이 빠르게 시작하여 끝으로 갈수록 감속됩니다.
InOut천천히 시작하여 중간에 가속되고, 끝에서 다시 감속되는 'In'과 'Out'을 결합한 스타일입니다.

생산성을 높일 수 있는 더 많은 유용한 도구를 찾고 계신가요?

더 많은 도구 둔러보기

이 튜토리얼이 도움이 되셨다면, 저의 작업을 지원하기 위해 커피 한 잔을 사주시면 감사하겠습니다.

지원해 주셔서 정말 감사합니다!

커피 한 잔 사주기