@acepad/canvas
v1.0.0
Published
Canvas utility in @acepad/widget
Readme
NOTE: This package is supporsed to work in acepad, not a regular node envronment.
@acepad/canvas
A canvas utility in @acepad/widget
functions
canvas()- Show widget which have Canvas element in full size of the widget.
- returns these property/methods in object
wCanvas width in pixelhCanvas height in pixelctxCanvas contextraf()returns Promise that resolves on nextrequestAnimationFrame
Example
import {canvas} from "@acepad/canvas";
export async function main(){
const {w,h,ctx,raf}=canvas();
for(let i=0;i<h;i++){
ctx.fillRect(
(i+(i>h/2?1:0))%2*w/2,
i,w/2,1);
await raf();
}
} How to run:
- Launch acepad.
- Open
node_modules/@acepad/canvas/test/test-acepad.canvas.js - Press F5
