Animate LineRenderer with many Positions

I have a lovely LineRenderer with a CatmullRom curve drawn across the screen. I’m looking for an efficient way to animate the line drawing across the screen.

This line can have almost 100 positions points assigned to it (to make the curve look nice) and I’m trying to figure out a good way to cycle through them all with a smooth animation. This might be really simple and I’m over-complicating it in my head.

So, that’s why I’m asking for some clarity.

Thanks in advance!

Alright! I got it drawing. :slight_smile: Here is the code I got it running with.

IEnumerator DrawLines(Segments _s)
{
    int i=0;		
    int next=i+1;
    Vector3 startPoint=_s.linesPoints*;*

Vector3 endPoint=_s.linesPoints[next];
_s.line.SetPosition(0,startPoint);

foreach(Vector3 p in _s.linesPoints)
{

  •  foreach(var t in Transition (.5f))//shortcut to calculate time*
    
  •  {*
    
  •      float u = EaseIn2(t);*
    
  •      Vector3 x=Lerp (startPoint,endPoint,u);*
    
  •      for(int j=next;j<_s.linesPoints.Count();j++)*
    
  •      _s.line.SetPosition(j,x);*
    

if(next<_s.linesPoints.Count()-1)
{

  •      i++;*
    
  •      next=i+1;*
    

startPoint=_s.linesPoints*;
endPoint=s.linesPoints[next];
_
}*

* }*
* yield return null;*
* }*
}

This may be helpful http://cgcookie.com/unity/2013/05/03/animate-a-line-draw-using-line-renderer-component/

@Whelandrew I am looking for something similar. (I want to have a glowing line grow along the floor to direct a player to follow it down a hallway, for example. Could you show a video or something of your final result? What object did you attach this script to? Any advice?