Color.Lerp 插值


static function Lerp (a : Color, b : Color, t : float) : Color

Description描述

Interpolates between colors a and b by t.

通过t在颜色a和b之间插值。

/t/ is clamped between 0 and 1. When t is 0 returns a. When t is 1 returns b.

"t"是夹在0到1之间的值。当t是0时返回颜色a。当t是1时返回颜色b。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public Color lerpedColor = Color.white;void Update() {erpedColor = Color.Lerp(Color.white, Color.black, Time.time);}}
// Converts a white color to a black one trough time.// 在一个时间段内将白色逐渐转换成黑色。var lerpedColor : Color = Color.white;function Update() {lerpedColor = Color.Lerp(Color.white, Color.black, Time.time);}


,