安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

alpha property is a Boolean value which, if present and set to true XRWebGLLayerInit dictionary passed into the XRWebGLLayer() constructor, specifies that the new layer's color buffer is to include an alpha channel . Otherwise, the color buffer won't have an alpha channel. The default is true .

句法

let layerInit = {
  alpha: boolValue
};
let glLayer = new XRWebGLLayer(xrSession, gl, layerInit);
let glLayer = new XRWebGLLayer(xrSession, gl, { alpha: boolValue });
					

A Boolean which can be set to true to request that the new WebGL layer for rendering the WebXR scene is to have an alpha channel.

范例

In this example, a new XRWebGLLayer is created for a WebXR session, xrSession , without an alpha channel.

xrSession.updateRenderState({
  baseLayer: new XRWebGLLayer(xrSession, gl, {
     alpha: false
  });
});
					

规范

规范 状态 注释
WebXR 设备 API
The definition of 'XRWebGLLayerInit.alpha' in that specification.
工作草案 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
alpha Chrome 79 Edge 79 Firefox No IE No Opera No Safari No WebView Android 79 Chrome Android 79 Firefox Android No Opera Android No Safari iOS No Samsung Internet Android 11.2

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: