This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

OffscreenCanvas()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2023년 3월⁩.

참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.

OffscreenCanvas() 생성자는 새롭게 초기화된 OffscreenCanvas 객체를 반환합니다.

구문

js
new OffscreenCanvas(width, height);

매개 변수

width

offscreen 캔버스의 너비

height

offscreen 캔버스의 높이

참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.

The OffscreenCanvas() constructor returns a newly instantiated OffscreenCanvas object.

예제

이 예제는 OffscreenCanvas() 생성자를 이용해 새로운 offscreen 캔버스를 생성하고, WebGL 맥락의 getContext() 메서드를 사용해 초기화합니다.

js
const offscreen = new OffscreenCanvas(256, 256);
const gl = offscreen.getContext("webgl");

명세서

Specification
HTML
# dom-offscreencanvas-dev

브라우저 호환성

더 보기