DarkTornado

Get Color

Jun 4th, 2011
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1.         //Return the current color of the particle.
  2.         private Color GetColor()
  3.         {
  4.             int index = timer * (color.Length - 1) / lifeTime + 1;
  5.             if (color.Length <= index)
  6.             {
  7.                 return color[index - 1];
  8.             }
  9.             Color color1 = color[index - 1];
  10.             Color color2 = color[index];
  11.             return Color.Lerp(color1, color2, (float)timer * (color.Length - 1) / lifeTime - index + 1);
  12.         }
Advertisement
Add Comment
Please, Sign In to add comment