其他分享
首页 > 其他分享> > Threejs封装电流效果

Threejs封装电流效果

作者:互联网

利用Threejs封装电流效果, 在initObject方法中添加一个路径就可以

  //样条线,根据规划的路径显示电流 云
        const curve_catmullRom3 = new THREE.CatmullRomCurve3( [
            new THREE.Vector3( 500, 500, 0 ),
            new THREE.Vector3(900, 600, 0 ),
            new THREE.Vector3(450, 200, 0 ),
            new THREE.Vector3(1100, 500, 0 ),
            new THREE.Vector3(1150, 450, 0 )
        ] );
        //根据样条线获得详细的点,用于处理拐角不平滑的问题
        let electricLine_sub3 = curve_catmullRom3.getPoints( 50 );
        electricLinePointArray.push({curIndex:0,pointList:electricLine_sub3});

如果需要修改电流的震动幅度修改electricLine.rayParams的参数

electricLine.rayParams = {
            sourceOffset: new THREE.Vector3(),   //电起点
            destOffset: new THREE.Vector3(),     //电重点
            radius0: 6,   //起点线的粗细0.1 -10   起始最好保持一致
            radius1: 6,  //结束线的粗细0.1 -

标签:Threejs,electricLine,封装,Vector3,THREE,new,电流,500
来源: https://blog.csdn.net/myfmyfmyfmyf/article/details/120706514