什么是 Color3:lerp?
What is Color3:lerp?
我一直在尝试使用它,但它不起作用,这是我的代码:
color = Color3.new(math.random(255),math.random(255),math.random(255))
print(color)
script.Parent.BackgroundColor3:lerp(color,0)
Color3:lerp
是一种在两个 Color3
值之间进行插值的方法。它基本上是 Color3
的 CFrame:lerp
。
您提供的代码不起作用的原因是您将 lerp
的 Delta
参数设置为 0。以下是如何正确使用它的示例:
local newColor = Color3.new(math.random(255), math.random(255), math.random(255))
for i=0,1,0.1 do
script.Parent.BackgroundColor3 = script.Parent.BackgroundColor3:lerp(newColor, i)
wait()
end
我一直在尝试使用它,但它不起作用,这是我的代码:
color = Color3.new(math.random(255),math.random(255),math.random(255))
print(color)
script.Parent.BackgroundColor3:lerp(color,0)
Color3:lerp
是一种在两个 Color3
值之间进行插值的方法。它基本上是 Color3
的 CFrame:lerp
。
您提供的代码不起作用的原因是您将 lerp
的 Delta
参数设置为 0。以下是如何正确使用它的示例:
local newColor = Color3.new(math.random(255), math.random(255), math.random(255))
for i=0,1,0.1 do
script.Parent.BackgroundColor3 = script.Parent.BackgroundColor3:lerp(newColor, i)
wait()
end