Skip to content

josephg/canvasproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple web module for syncronously making simple repeating canvas based animations.

I wrote this because I wanted to programatically render an animated gif for an example, but its way simpler to just buffer canvas drawing calls and render them.

Usage

var canvas = document.getElementById("mycanvas");
canvas.width = 320;
canvas.height = 240;

ctx = canvasProxy(canvas)
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 320, 240);
ctx.commitFrame();
ctx.fillStyle = 'green';
ctx.fillRect(0, 0, 320, 240);
ctx.commitFrame();
ctx.fillStyle = 'blue';
ctx.fillRect(0, 0, 320, 240);
ctx.commitFrame();

// play(delayMS, repeat);
ctx.play(300, true);

// ... Later, if you want.
ctx.stop()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published