Material材质 翻译:titan-志广
- color
- CopyPropertiesFromMaterial
- GetColor
- GetFloat
- GetMatrix
- GetTag
- GetTextureOffset
- GetTextureScale
- GetTexture
- GetVector
- HasProperty
- Lerp
- mainTextureOffset
- mainTextureScale
- mainTexture
- Material
- passCount
- renderQueue
- SetColor
- SetFloat
- SetMatrix
- SetPass
- SetTextureOffset
- SetTextureScale
- SetTexture
- SetVector
- shader
Material.color 颜色
var color : Color
Description描述
The main material's color.
主材质的颜色。
The same as using GetColor or SetColor with "_Color" name.
使用带有“_Color“的名字的GetColor或SetColor是一样的。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Color colorStart = Color.red;
public Color colorEnd = Color.green;
public float duration = 1.0F;
void Update() {
float lerp = Mathf.PingPong(Time.time, duration) / duration;
renderer.material.color = Color.Lerp(colorStart, colorEnd, lerp);
}
}
// Fade the color from red to green
//渐变颜色从红色到绿色
// back and forth over the defined duration
//定义循环的时间
var colorStart : Color = Color.red ;
var colorEnd : Color = Color.green ;
var duration : float = 1.0;
function Update () {
var lerp : float = Mathf.PingPong ( Time.time , duration) / duration;
renderer.material.color = Color.Lerp (colorStart, colorEnd, lerp);
}
最后修改:2011年1月21日 Friday 22:00