From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../api/webglrenderingcontext/canvas/index.html | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 files/ru/web/api/webglrenderingcontext/canvas/index.html (limited to 'files/ru/web/api/webglrenderingcontext/canvas') diff --git a/files/ru/web/api/webglrenderingcontext/canvas/index.html b/files/ru/web/api/webglrenderingcontext/canvas/index.html new file mode 100644 index 0000000000..7b76f9885b --- /dev/null +++ b/files/ru/web/api/webglrenderingcontext/canvas/index.html @@ -0,0 +1,70 @@ +--- +title: WebGLRenderingContext.canvas +slug: Web/API/WebGLRenderingContext/canvas +translation_of: Web/API/WebGLRenderingContext/canvas +--- +
{{APIRef("WebGL")}}
+ +

Свойство WebGLRenderingContext.canvas доступно только для чтения. Возвращает ссылку на объекты {{domxref("HTMLCanvasElement")}} или {{domxref("OffscreenCanvas")}} связанные с установленным контекстом отрисовки. Если объект {{HTMLElement("canvas")}} или  {{domxref("OffscreenCanvas")}} не связан с контекстом, то возвращается значение {{jsxref("null")}}.

+ +

Syntax

+ +
gl.canvas;
+ +

Return value

+ +

Either a {{domxref("HTMLCanvasElement")}} or {{domxref("OffscreenCanvas")}} object or {{jsxref("null")}}.

+ +

Examples

+ +

Canvas element

+ +

Given this {{HTMLElement("canvas")}} element:

+ +
<canvas id="canvas"></canvas>
+
+ +

You can get back a reference to it from the WebGLRenderingContext using the canvas property:

+ +
var canvas = document.getElementById('canvas');
+var gl = canvas.getContext('webgl');
+gl.canvas; // HTMLCanvasElement
+
+ +

Offscreen canvas

+ +

Example using the experimental {{domxref("OffscreenCanvas")}} object.

+ +
var offscreen = new OffscreenCanvas(256, 256);
+var gl = offscreen.getContext('webgl');
+gl.canvas; // OffscreenCanvas
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('WebGL', "#DOM-WebGLRenderingContext-canvas", "WebGLRenderingContext.canvas")}}{{Spec2('WebGL')}}Initial definition.
+ +

Browser compatibility

+ + + +

{{Compat("api.WebGLRenderingContext.canvas")}}

+ +

See also

+ + -- cgit v1.2.3-54-g00ecf