Classe de moteur
Decal
*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.
Résumé
Propriétés
ColorMap:ContentId |
MetalnessMap:ContentId |
NormalMap:ContentId |
RoughnessMap:ContentId |
Texture:ContentId |
TexturePack:ContentId |
Hérité par
Échantillons de code
Changement de texture de décalque
-- créer une partie
local part = Instance.new("Part")
part.Size = Vector3.new(5, 1, 5)
part.Position = Vector3.new(0, 0.5, 0)
part.Anchored = true
part.TopSurface = Enum.SurfaceType.Smooth
part.BrickColor = BrickColor.new("Dentifrice")
-- créer un décalque
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Top
decal.Parent = part
-- définir les visages
local happyFace = Content.fromUri("http://www.roblox.com/asset/?id=26424652")
local sadFace = Content.fromUri("http://www.roblox.com/asset/?id=147144198")
decal.ColorMapContent = happyFace
-- événement touché
local cooldown = false
part.Touched:Connect(function(hit)
if not cooldown then
if hit and hit.Parent then
cooldown = true
sound:Play()
decal.ColorMapContent = sadFace
task.wait(1)
decal.ColorMapContent = happyFace
task.wait(0.2)
cooldown = false
end
end
end)
-- ajouter au workspace
part.Parent = workspaceDécalque de Fading
local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Size = Vector3.new(10, 10, 1)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Transparency = 1
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Front
decal.ColorMapContent = Content.fromUri("http://www.roblox.com/asset/?id=699259085") -- logo roblox
decal.Parent = part
part.Parent = workspace
local tween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true),
{ Transparency = 1 }
)
tween:Play()Référence API
Propriétés
Color3
Échantillons de code
Couleur3 de Décalcomanie
local TweenService = game:GetService("TweenService")
local part = Instance.new("Part")
part.Size = Vector3.new(10, 10, 1)
part.Position = Vector3.new(0, 5, 0)
part.Anchored = true
part.Transparency = 1
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId.Front
decal.ColorMapContent = Content.fromUri("http://www.roblox.com/asset/?id=1145367640")
decal.Parent = part
part.Parent = workspace
local redTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(1, 0, 0) }
)
local greenTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(0, 1, 0) }
)
local blueTween = TweenService:Create(
decal,
TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
{ Color3 = Color3.new(0, 0, 1) }
)
while true do
redTween:Play()
redTween.Completed:Wait()
greenTween:Play()
greenTween.Completed:Wait()
blueTween:Play()
blueTween.Completed:Wait()
endColorMap
Decal.ColorMap:ContentId
MetalnessMap
Decal.MetalnessMap:ContentId
NormalMap
Decal.NormalMap:ContentId
RoughnessMap
Decal.RoughnessMap:ContentId
Shiny
Specular
Texture
TextureContent
TexturePack
Decal.TexturePack:ContentId