codecamp

three.js EllipseCurve

创建一个形状为椭圆的曲线。 将xRadius与yRadius设为相等的值它将会成为一个圆。

代码示例

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

const points = curve.getPoints( 50 );
const geometry = new THREE.BufferGeometry().setFromPoints( points );

const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );

// Create the final object to add to the scene
const ellipse = new THREE.Line( geometry, material );

构造函数

EllipseCurve( aX : Float, aY : Float, xRadius : Float, yRadius : Float, aStartAngle : Radians, aEndAngle : Radians, aClockwise : Boolean, aRotation : Radians )

aX – 椭圆的中心的X坐标,默认值为0
aY – 椭圆的中心的Y坐标,默认值为0
xRadius – X轴向上椭圆的半径,默认值为1
yRadius – Y轴向上椭圆的半径,默认值为1
aStartAngle – 以弧度来表示,从正X轴算起曲线开始的角度,默认值为0
aEndAngle – 以弧度来表示,从正X轴算起曲线终止的角度,默认值为2 x Math.PI
aClockwise – 椭圆是否按照顺时针方向来绘制,默认值为false
aRotation – 以弧度表示,椭圆从X轴正方向逆时针的旋转角度(可选),默认值为0

属性

共有属性请参见其基类Curve。

.aX : Float

椭圆的中心的X坐标。

.aY : Float

椭圆的中心的Y坐标。

.xRadius : Radians

X轴向上椭圆的半径。

.yRadius : Radians

Y轴向上椭圆的半径。

.aStartAngle : Float

以弧度来表示,从正右侧算起曲线开始的角度。

.aEndAngle : Float

以弧度来表示,从正右侧算起曲线终止的角度。

.aClockwise : Boolean

椭圆是否按照顺时针方向来绘制。

.aRotation : Float

以弧度表示,椭圆在X轴正方向逆时针的旋转角度(可选),默认值为0。

方法

共有方法请参见其基类Curve。

源代码

src/extras/curves/EllipseCurve.js


three.js CubicBezierCurve3
three.js LineCurve
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

参考

核心 / BufferAttributes

渲染器 / WebXR

开发者参考

WebGL渲染器

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }