스파클은 여러 입자 방출 클래스 중 하나입니다.같은 종류의 다른 입자 방출기와 마찬가지로, 스파클 개체는 부모로 지정된 경우 (예: ) 또는 그러한 경우 내부의 내에서 입자를 방출합니다.ParticleEmitter 클래스와 비교하면, 스파클은 다양한 사용자 지정 속성과 특수 메서드(예: ParticleEmitter.Lifetime 또는 ParticleEmitter:Emit() )가 부족합니다.시간에 쫓겨 빠른 특수 효과를 만드는 것이 유용하지만, 더 자세한 작업을 수행하려면 ParticleEmitter 대신 사용하는 것이 좋습니다.
Sparkles.Enabled가 끄기이 개체에서 방출되는 입자는 수명이 만료될 때까지 계속 렌더링됩니다.스파클 개체의 가 설정되면 모든 입자가 즉시 사라집니다(그리고/또는 편집됨).이 효과가 원하지 않는 경우, 멀리 있는 위치에서 부모 개체를 숨기고, 을 사용하여 몇 초 후에 반짝임을 제거하여 마지막 입자가 만료될 수 있도록 기회를 제공합니다.이 개체에는 ParticleEmitter:Clear() 메서드가 없지만 Instance.Parent 를 nil 로 설정하고 동일한 효과를 위해 동일한 개체로 되돌릴 수 있습니다.
스파클 입자는 부모로 지정된 중심에서만 BasePart에서 방출됩니다.반짝이 개체를 Attachment 대신 부모로 지정하면 입자의 시작 위치를 사용자 지정할 수 있습니다.
코드 샘플
The code sample below gives any new players sparkles that are colored the same as their torso color.
local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)
요약
속성
반짝이 입자의 색상을 결정합니다.
반짝임이 방출되는지 여부를 결정합니다.
반짝이 입자의 색상을 결정합니다.
속성
Color
색상 속성은 기존 및 미래의 모든 입자를 방출하는 Sparkles 개체의 색상을 결정합니다.그것은 색상이 하나이고 ParticleEmitter.Color가 아닌 것을 제외하고 동일하게 행동합니다 ColorSequence .스파클에는 자연스러운 색상 시퀀스가 적용되어 이 속성이 하얀색으로 설정되면 가장 두드러집니다; 매우 약간 스파클은 미묘한 녹색과 빨간색 사이에서 매우 약간 애니메이션됩니다.
반짝임에는 부분적인 ParticleEmitter.LightEmission 효과가 있으므로 어두운 색상은 더 투명하게 렌더링되고 흰색은 매우 밝게 보입니다.
코드 샘플
The code sample below gives any new players sparkles that are colored the same as their torso color.
local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)
Enabled
Enabled 속성, 마치 ParticleEmitter.Enabled와 같이, 반짝이 입자가 방출되는지 여부를 결정합니다.이미 방출된 모든 입자는 수명이 만료될 때까지 계속 렌더링됩니다.이 속성은 나중에 필요할 때까지 미리 만들어진 반짝임 효과를 제거하는 데 유용합니다.반짝이 입자는 개체의 가 설정되면 파괴되므로, 이 속성은 기존 입자가 파이어 개체를 완전히 파괴하기 전에 만료할 수 있는 기회를 제공하는 데 유용합니다.아래 함수를 참조하십시오.
local Debris = game:GetService("Debris")
local part = script.Parent
function stopSparkling(sparkles)
sparkles.Enabled = false -- No more new particles
Debris:AddItem(sparkles, 4) -- Remove the object after a delay (after existing particles have expired)
end
stopSparkling(part.Sparkles)
코드 샘플
The code sample below gives any new players sparkles that are colored the same as their torso color.
local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)
LocalTransparencyModifier
SparkleColor
이 속성은 Sparkles.Color와 동일하게 기능합니다.
SparkleColor 속성은 기존 및 미래의 모든 입자를 방출하는 Sparkles 개체의 색상을 결정합니다.그것은 색상이 하나이고 ParticleEmitter.Color가 아닌 것을 제외하고 동일하게 행동합니다 ColorSequence .스파클에는 자연스러운 색상 시퀀스가 적용되어 이 속성이 하얀색으로 설정되면 가장 두드러집니다; 매우 약간 스파클은 미묘한 녹색과 빨간색 사이에서 매우 약간 애니메이션됩니다.
반짝임에는 부분적인 ParticleEmitter.LightEmission 효과가 있으므로 어두운 색상은 더 투명하게 렌더링되고 흰색은 매우 밝게 보입니다.
코드 샘플
The code sample below gives any new players sparkles that are colored the same as their torso color.
local Players = game:GetService("Players")
local function onCharacterSpawned(character)
local hrp = character:WaitForChild("HumanoidRootPart")
-- Add sparkles that are colored to the player's torso color
local sparkles = Instance.new("Sparkles")
sparkles.Parent = hrp
sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color
sparkles.Enabled = true
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterSpawned)
end
Players.PlayerAdded:Connect(onPlayerAdded)