如何创建实心椭圆并用three.js中的特定颜色填充它?

时间:2017-02-27 20:08:37

标签: javascript three.js

我是three.js的初学者。这是我创建线性椭圆的代码。我想要的只是一个纯色的实心椭圆   我还想知道如何在整个屏幕上创建实体椭圆。

var curve = new THREE.EllipseCurve(
0,  0,            // ax, aY
2, 16,           // xRadius, yRadius
0,  2 * Math.PI,  // aStartAngle, aEndAngle
false,            // aClockwise
0                 // aRotation
);

//ellipse
var path = new THREE.Path( curve.getPoints( 50 ) );
var geometry = path.createPointsGeometry( 50 );
var material = new THREE.MeshBasicMaterial( { color : 0x59d1c1} );
var ellipse = new THREE.Line( geometry, material );
scene.add(ellipse);

1 个答案:

答案 0 :(得分:0)

使用THREE.ShapeTHREE.ShapeBufferGeometry类。这是一个例子:

var path = new THREE.Shape();
path.absellipse(0,0,2,16,0, Math.PI*2, false,0);
var geometry = new THREE.ShapeBufferGeometry( path );
var material = new THREE.MeshBasicMaterial( { color: 0x59d1c1} );
var ellipse = new THREE.Mesh( geometry, material );
scene.add(ellipse);