- Home /
Line renderer; can you change the gradient's colorkeys/alphakeys location?
Hey! I'm trying to achieve the effect of rain on a window, so I've been using a Line Renderer to generate points moving down the screen. As far as changing its colour to fade over time, right now I'm using this;
t += Time.deltaTime * speed;
GradientColorKey[] colorKeys = lineR.colorGradient.colorKeys;
GradientAlphaKey[] alphaKeys = lineR.colorGradient.alphaKeys;
alphaKeys[1].alpha = alphaKeys[1].alpha - t / 800;
newG.SetKeys(colorKeys, alphaKeys);
lineR.colorGradient = newG;
However the fade is too uniform along each line's length as you'd expect. But in using the location slider of the transparent alpha, it looks closer to what I'm aiming for, as the trace of water on the window pane tries to "catch up".
After scouring forums it seems the location value for the color/alphakeys aren't exposed; have I missed something or should I hope to see it added in a future update?
Thanks, Adam.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Renderer on object disabled after level reload 1 Answer
Unity 2D -Reflecting a linerenderer 2 Answers
LineRenderer BakeMesh is turning/rotating the line? 1 Answer