How to control the slow growth of 3D curves created by threejs

problem description

the curve generated by CatmullRomCurve3 will be displayed as a whole, how to make it longer slowly

related codes

          var curve = new THREE.CatmullRomCurve3( [
            new THREE.Vector3( 0, 0, 0 ),
            new THREE.Vector3( 1, -1, -1 ),
            new THREE.Vector3( -5, 5, 5 )
          ] );

          var geometry = new THREE.Geometry();
          geometry.vertices = curve.getPoints( 50 );
          console.log(curve);
          var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
          addMesh = new THREE.Line(geometry, material);
          scene.add(addMesh);
          
Mar.31,2021

create a dashed line. The initial state controls that the solid part is 0 and the dotted part is long enough, and then the growth animation is realized by controlling the allocation of the virtual and real length of the dashed line in each frame

.
Menu