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后,才发现是
因此把残血的红色和满血的绿色对调一下就可以了
相关文章推荐
- 简述unity中material.color及Color.Lerp线性插值的用法
- Unity3D中的线性插值Lerp()函数解析
- 面向组件编程之Unity 11.Quaternion类属性 线性插值Lerp() 关键字:按键控制游戏物体朝向
- Unity3D中的线性插值Lerp()函数解析
- Unity3D中的线性插值Lerp()函数解析
- Unity3D中的线性插值Lerp()函数解析
- Unity3D中的线性插值Lerp()函数解析
- COCOS2d 随手记 -- CCColorLayer
- Csharp: Winform 顏色選擇器 Color convert RGB and RGB convert Color
- Setting the Pen or Brush Color
- WordPress Colormix主题多个安全漏洞
- emacs下color-theme.el的正确配置方法
- Android 定义 Color 和 Drawable 的方法
- Yii-bootstrap TbMenu修改默认背景颜色(background-color)
- Eclipse Color Theme的使用
- POJ 1046 Color Me Less(浅水)
- hdu 1556 Color the ball 线段树,树状树组,与dp思想的树组解决技巧
- SRM 587 Div II L3:ThreeColorabilityEasyy
- POJ1046 Color Me Less
- 利用WM_CTLCOLOR消息实现编辑控制(Edit Control)的文本与背景色的改变