您的位置:首页 > 其它

Color.Lerp 线性插值

2017-08-07 21:24 281 查看


Color.Lerp 线性插值


Description 描述

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

C#:
using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
public Color lerpedColor = Color.white;
void Update() {
lerpedColor = Color.Lerp(Color.white, Color.black, Mathf.PingPong(Time.time, 1));
}
}


设置坦克血条时遇到的傻瓜问题。没有受到伤害时,初始血量是等于开始血量的   m_CurrentHealth = m_StartingHealth;
但坦克的血条上来就是红色的,很不解。
仔细看了Color.Lerp()的圣典API后,才发现是
因此把残血的红色和满血的绿色对调一下就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: