纳金网

标题: 霓虹灯效果的代码 [打印本页]

作者: 狂风大尉    时间: 2014-9-28 22:45
标题: 霓虹灯效果的代码

让模型灯实现霓虹灯的效果,可以使用Animation,也可以使用代码进行Color的插值运算
获取material:  transform.renderer.materials[]
改变material材质的颜色:
float lerp = Mathf.PingPong(Time.time, 1.0f) / 1.0f;
material.color = Color.Lerp(Color.yellow, Color.red, lerp);
PingPong是让数值反复
Color.Lerp(Color a,Color b,float t);  t的取值在0-1之间,当t=0时,material.color为a,当t=1时,material.color为b。


作者: HIDEOKOJIMA    时间: 2014-9-28 23:24
Thanks for sharing this one !
作者: oelongeo    时间: 2014-9-29 05:13
实用 谢谢指导
作者: cgjch8    时间: 2014-9-29 09:15
bu cuo bu cuo
作者: hyui    时间: 2014-10-2 07:06
Thanks for this !                                         




欢迎光临 纳金网 (http://course.narkii.com/club/) Powered by Discuz! X2.5