Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 17th, 2012  |  syntax: None  |  size: 0.68 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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);