Created
January 1, 2018 18:23
-
-
Save eeropic/c1c6a4303d90f49a3b4b198a6a15d81e to your computer and use it in GitHub Desktop.
GIF.js test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gif = new GIF({ | |
| workers: 2, | |
| quality: 10 | |
| }); | |
| gif.on('finished', function(blob) { | |
| window.open(URL.createObjectURL(blob)); | |
| }); | |
| var rect=new Path.Rectangle([0,0],[200,200]) | |
| rect.fillColor="red" | |
| var myTool=new Tool(); | |
| myTool.on({ | |
| mousedown(e){ | |
| this.path=new Path() | |
| this.path.strokeColor="black" | |
| this.path.strokeWidth=2 | |
| }, | |
| mousedrag(e){ | |
| this.path.add(e.point) | |
| }, | |
| mouseup(e){ | |
| }, | |
| keydown(e){ | |
| if(e.key=="1"){ | |
| canvas=document.getElementById('canvas'); | |
| ctx = canvas.getContext('2d'); | |
| gif.addFrame(canvas, {copy: true,delay: 100}); | |
| //console.log(ctx.canvas.height) | |
| } | |
| if(e.key=="2"){ | |
| gif.render(); | |
| console.log('sepp doooo') | |
| } | |
| } | |
| }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment