blob: b04b9663aa68125539a9d481308ee3473ff3f776 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
'use strict';
export function draw(canvas, size, fn) {
const ctx = canvas.getContext("2d");
const scale = canvas.clientWidth/size;
ctx.save();
ctx.scale(scale, scale);
ctx.clearRect(0, 0, size, size);
fn(ctx);
ctx.restore();
}
|