- Home /
Move Towards Target Color
I have small requirement related to color transformation.
Basically I want to move from red color to yellow color in consecutive five steps not directly.
For red color code is (255,0,0) and yellow color code is (255,255,0). I want to move towards yellow gradually not directly. I want to move towards yellow color in five step.
I want suggestion to clear this task.
Answer by SirMalarkey · Jul 03, 2014 at 03:39 AM
You may be able to make use of the Color.Lerp function just set the parameter t to a variable in a loop that adds .2 each loop. This will work because the t parameter of Color.lerp is a range of 0-1 so by stepping it by .2 you will get 5 steps in your color change.
Answer by mattyman174 · Jul 03, 2014 at 03:39 AM
http://docs.unity3d.com/ScriptReference/Color.Lerp.html
Not sure what you mean by "in five steps"?
Check out the Color.Lerp() function in the documentation link above.
Your answer
![](https://koobas.hobune.stream/wayback/20220613153050im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Custom Pivot Points in Sprite Editor 1 Answer
How to apply OnMouseDown on sprites according to z position... 3 Answers
A node in a childnode? 1 Answer
How to get "pixel" color for Sprite (U4.3)? 2 Answers
Sprite Renderer - Tint Sprite? 0 Answers