最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Three.js - Shape fill color - Stack Overflow

programmeradmin2浏览0评论

I have the following code which draws a yellow circle:

  var radius = 5,
    segments = 64,
    material = new THREE.LineBasicMaterial( { color: 0xF0C400 } ),
    geometry = new THREE.CircleGeometry( radius, segments );

  geometry.vertices.shift();
  var circle = new THREE.Line(geometry, material);

  circle.position.set(5,5,0);
  circle.rotation.set(1.57,0,0);
  scene.add(circle);

My only question is how do I get this circle filled with color? I tried to change the material but I still only see the outline shape..

Update: I had to change the THREE.Line to THREE.Mesh..!

I have the following code which draws a yellow circle:

  var radius = 5,
    segments = 64,
    material = new THREE.LineBasicMaterial( { color: 0xF0C400 } ),
    geometry = new THREE.CircleGeometry( radius, segments );

  geometry.vertices.shift();
  var circle = new THREE.Line(geometry, material);

  circle.position.set(5,5,0);
  circle.rotation.set(1.57,0,0);
  scene.add(circle);

My only question is how do I get this circle filled with color? I tried to change the material but I still only see the outline shape..

Update: I had to change the THREE.Line to THREE.Mesh..!

Share Improve this question edited Apr 13, 2014 at 14:41 lephleg asked Apr 12, 2014 at 17:11 lephleglephleg 1,7642 gold badges22 silver badges41 bronze badges 1
  • for me this draws an eclipse..?why – GvSharma Commented Sep 22, 2016 at 7:49
Add a ment  | 

1 Answer 1

Reset to default 5
material = new THREE.MeshBasicMaterial( { color: 0xF0C400, side: THREE.DoubleSide } );

geometry = new THREE.CircleGeometry( radius, segments );

mesh = new THREE.Mesh( geometry, material );

For a more general solution, see http://threejs/examples/canvas_geometry_shapes.html

three.js r.66

发布评论

评论列表(0)

  1. 暂无评论