XRCylinderLayer: centralAngle property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Thuộc tính centralAngle của giao diện XRCylinderLayer đại diện cho góc tính bằng radian của phần hình trụ hiển thị.

Giá trị

Số đại diện cho góc tính bằng radian của phần hình trụ hiển thị.

Ví dụ

Lấy góc trung tâm của lớp

Phương thức XRWebGLBinding.createCylinderLayer() tạo lớp hình trụ và cho phép chỉ định centralAngle. Thuộc tính XRCylinder.centralAngle có thể được dùng sau khi tạo lớp để lấy góc trung tâm được dùng hoặc đặt thành góc mới.

js
const cylinderLayer = xrGlBinding.createCylinderLayer({
  space: xrReferenceSpace,
  viewPixelWidth: 1200,
  viewPixelHeight: 600,
  centralAngle: (60 * Math.PI) / 180,
  aspectRatio: 2,
  radius: 2,
  transform: new XRRigidTransform(/* … */),
});

cylinderLayer.centralAngle; // 1.0471975511965976

Thông số kỹ thuật

Specification
WebXR Layers API Level 1
# dom-xrcylinderlayer-centralangle

Tương thích trình duyệt

Xem thêm