什么是 Color3:lerp?

我一直在尝试做一些实验,但这不起作用,这是我的代码:

color = Color3.new(math.random(255),math.random(255),math.random(255))
print(color)
script.Parent.BackgroundColor3:lerp(color,0)
点赞
用户4107254
用户4107254

Color3:lerp 是在两个 Color3 值之间插值的一种方式。它基本上是 Color3CFrame:lerp

你提供的代码不起作用的原因是因为你将 lerpDelta 参数设置为 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
2017-09-10 23:28:34