Guest User

Untitled

a guest
Jul 17th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. how to convert a 2d path to a 3d shape in Three.js?
  2. var shape = new THREE.Shape();
  3. shape.moveTo(20,20);
  4. shape.bezierCurveTo(20, 100, 150, 100, 150, 20);
  5. shape.moveTo(20,20);
  6. shape.lineTo(20, 100);
  7. shape.lineTo(150, 100);
  8. shape.lineTo(150, 20);
  9.  
  10. var shape3d = shape.extrude(extrudeSettings);
  11. var shapePoints = shape.createPointsGeometry();
  12. var shapeSpacedPoints = shape.createSpacedPointsGeometry();
  13. var material = new THREE.MeshBasicMaterial({ color: 0x0000ff });
  14. var shapeMesh = new THREE.Mesh(shape3d, material);
  15.  
  16. var shape = new THREE.Shape();
  17. shape.moveTo(20,20);
  18. shape.bezierCurveTo(20, 100, 150, 100, 150, 20);
  19. shape.lineTo(150, 100);
  20. shape.lineTo(20, 100);
  21. shape.moveTo(20,20);
Advertisement
Add Comment
Please, Sign In to add comment