2d-context 中文文档教程
2d-context
获取 CanvasRenderingContext2D,如果不存在则返回 null。 类似于 webgl-context。
var context = require('2d-context')()
var canvas = context.canvas
或
var canvas = document.createElement('canvas')
var context = require('2d-context')({
canvas: canvas,
alpha: true,
width: 256,
height: 256
})
Usage
ctx = require('2d-context')([opt])
获取带有可选参数的新画布上下文:
canvas
a canvas element to use, otherwise creates a new elementwidth
a width to set, otherwise no changeheight
a height to set, otherwise no change- other attributes are passed to the getContext call, like
alpha
andstorage
然后您可以使用 ctx.canvas
获取画布元素的引用。
License
麻省理工学院,详见 LICENSE.md。
2d-context
Grabs a CanvasRenderingContext2D, returning null if it doesn't exist. Similar to webgl-context.
var context = require('2d-context')()
var canvas = context.canvas
or
var canvas = document.createElement('canvas')
var context = require('2d-context')({
canvas: canvas,
alpha: true,
width: 256,
height: 256
})
Usage
ctx = require('2d-context')([opt])
Gets a new canvas context with optional parameters:
canvas
a canvas element to use, otherwise creates a new elementwidth
a width to set, otherwise no changeheight
a height to set, otherwise no change- other attributes are passed to the getContext call, like
alpha
andstorage
You can then get a reference of the canvas element with ctx.canvas
.
License
MIT, see LICENSE.md for details.
更多
你可能也喜欢
- @20tab/react-leaflet-resetview 中文文档教程
- @6river/prettier-config 中文文档教程
- @9renpoto/textlint-config-ja 中文文档教程
- @a11you/my-js-project 中文文档教程
- @aaronlcj/node-dualsense-ts 中文文档教程
- @abinavseelan/papers-please 中文文档教程
- @abt-desk/apm 中文文档教程
- @accionlabs/healthcheck-node 中文文档教程
- @account-coddle/pokerfire 中文文档教程
- @acm-js/system 中文文档教程