title: How to animate the growth of a line in Three.js?
body: <p><strong>What I have:</strong></p>
  
  <pre><code>var pointA = new THREE.Vector3(camera_RC_Holder.position.x, camera_RC_Holder.position.y, camera_RC_Holder.position.z);
  
  var direction = camera_RC.position.clone();
  direction.applyMatrix4( camera_RC.matrixWorld );
  direction.normalize();
  
  var distance = 700;
  
  var pointB = new THREE.Vector3();
  pointB.addVectors ( pointA, direction.multiplyScalar( -distance ) );
  
  var geometry = new THREE.Geometry();
  geometry.vertices.push( pointA );
  geometry.vertices.push( pointB );
  
  var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
  var line = new THREE.Line( geometry, material );
  
  scene_Main.add( line );
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ZzAOy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZzAOy.png" alt="enter image description here"></a></p>
  
  <p><strong>What I want:</strong></p>
  
  <p>What I'm trying to do is to show that a ray has began from the camera and explores through the view volume. So, instead of instantly create a line (point_A, point_B) I want to grow the line from point_A pixel by pixel until it meets it's destination (point_B).</p>
  
  <p><strong>Question:</strong></p>
  
  <p>How to draw the lines pixel by pixel as shown in the code snippet below??</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var w = 200;
  var h = 150;
  var x;
  
  function setup(){
  
    createCanvas(w,h);
    x=0;
    y=0;
  }
  
  function draw(){
    
    
    if(x&gt;w){
      x = 0;
    }
    background(250);
    line(0,50,x,50); //x1,y1,x2,y2
    x++;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/p5.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>