Color32.Lerp 插值

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

Description描述

Interpolates between colors a and b by t.

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

/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。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	public Color32 colorWhite = Color.white;

	public Color32 colorBlack = Color.black;

	public Color32 lerpedColor = Color.white;

	void Update() {

		lerpedColor = Color32.Lerp(colorWhite, colorBlack, Time.time);

	}

}
// Converts a white color to a black one trough time.

//经过一段时间转换白色到黑色

var colorWhite : Color32 = Color.white;

var colorBlack : Color32 = Color.black;

var lerpedColor : Color32 = Color.white;

function Update() {

	lerpedColor = Color32.Lerp(colorWhite, colorBlack, Time.time);

}
Page last updated: 2011-9-15