Permalink
Browse files

Merge pull request #12 from djcsdy/readme-fix

Fix formatting mistakes in README + 1 typo
  • Loading branch information...
2 parents 55ce409 + be5defb commit da80ac92e0d1e24f72dcd602c91c8ae5a840bdf3 @antimatter15 committed Oct 14, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 README.md
View
@@ -21,7 +21,7 @@ Since it pretty much *is* GIFEncoder, you could consult the [as3gif how-to page]
But there are some differences so I'll cover it here anyway.
-You first need to include the JS files. It's probably best if you include it in this order, but it shouldnt' matter too much.
+You first need to include the JS files. It's probably best if you include it in this order, but it shouldn't matter too much.
<script type="text/javascript" src="LZWEncoder.js"></script>
<script type="text/javascript" src="NeuQuant.js"></script>
@@ -45,9 +45,11 @@ Simple enough right? Now to convert stuff to GIF, you need to have a working <ca
context.fillRect (10, 10, 75, 50); //draw a little red box
Now we need to init the GIFEncoder.
+
var encoder = new GIFEncoder();
*If* you are making an animated gif, you need to add the following
+
encoder.setRepeat(0); //0 -> loop forever
//1+ -> loop n times then stop
encoder.setDelay(500); //go to next frame every n milliseconds
@@ -69,6 +71,7 @@ pass a imageData.data-like array. If you pass a canvas context, then that's all
setSize with the canvas width/height stuff.
Now the last part is to finalize the animation and get it for display.
+
encoder.finish();
var binary_gif = encoder.stream().getData() //notice this is different from the as3gif package!
var data_url = 'data:image/gif;base64,'+encode64(binary_gif);

0 comments on commit da80ac9

Please sign in to comment.