@nicoleffect/canvas-retina
v1.0.1
Published
you can see the HD canvas
Downloads
6
Maintainers
Readme
canvas-retina
you can see the HD canvas
use for
examples
// html
<canvas id="canvas"></canvas>
// npm install @nicoleffect/canvas-retina
import canvasRetina from '@nicoleffect/canvas-retina'
const {
pixelRatio, // value of devicePixelRatio / backingStore, if you need this
ctx, // object of canvas dom getContext('2d'), if you need this
rect // object of canvas dom getBoundingClientRect(), if you need this
} = canvasRetina(document.getElementById('canvas'))
// or
<script src="https://nicoleffect.github.io/canvas-retina/dist/canvas-retina.iife.min.js"></script>
<script>
canvasRetina(document.getElementById('canvas'))
...
</script>
all modes
amd、cjs、es、iife、umd