如何使用three.js制作线性扫面?

时间:2016-05-25 05:14:24

标签: javascript three.js

如何制作线性扫面?

我写了以下代码。

      // profile
      var pts = [
        new THREE.Vector2(0, 0), 
        new THREE.Vector2(10, 0), 
        new THREE.Vector2(10, 10), 
        new THREE.Vector2(20, 10), 
        new THREE.Vector2(20, 20),
      ];
      var profile = new THREE.Shape(pts);
      // path
      var path = new THREE.LineCurve3(new THREE.Vector3(0, 0, 0), new THREE.Vector3(30, 0, 30));
      var geometry = new THREE.ExtrudeGeometry(profile , { steps: 1, bevelEnabled: false, extrudePath: path });
      var material = new THREE.MeshLambertMaterial({ color: 0xff8000, wireframe: false });
      var mesh = new THREE.Mesh(geometry, material);
      scene.add(mesh);

我得到了一个结果

http://i.imgur.com/7YDPMK7.jpg

但这不是我的需要。我的希望是

http://i.imgur.com/sHUJ6JN.jpg

有什么问题?