什么是Color3:lerp?
问题描述:
我一直在试图鬼混其,和它不工作,这是我的代码:什么是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
。
您所提供的代码是不工作的原因是因为你有Delta
说法lerp
组为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