<commit_before># Overview

Re-forked from BuzzFeed's libgif project (https://github.com/buzzfeed/libgif-js), which was forked from the excelent[sic] jsgif project (https://github.com/shachaf/jsgif), which was implemented as a bookmarklet to manipulate animated gifs (http://slbkbs.org/jsgif).

This is an attempt to modernize the async handling of the library (which was not very good), and also to add some features which I found useful, such as exposing the frames object with an optional data URL for each frame.
# Example

See `example.html` for some super basic examples, if you're not familiar with the library.

See `async_example.html` for tips on using this library with [async](http://caolan.github.io/async/).

See `tween_example.html` for a cool application of the library: gifs that play/rewind as you scroll the page.

Please note: examples must be loaded via a webserver, not directly from disk. I.e. http://localhost/sibgif/example.html NOT file:///sibgif/example.html. See the same-domain origin caveat at the bottom of this document for more information. I use [http-server](https://github.com/indexzero/http-server) to do this, and you should too!

There are also hosted demos at http://sibnerian.com/example.html, http://sibnerian.com/async_example.html, and http://sibnerian.com/tween_example.html.

## Class: SuperGif

### Example Usage:

```html
		<img id="myImage" src="./example1_preview.gif" data-animated-source="./example1.gif"
			width="360" height="360" data-autoplay="1" />

		<script type="text/javascript">
			var gif = new SuperGif({
				gif: document.getElementById('myImage')
			});
			gif.load(function (err) {
				if (err) {
					console.error(err);
				} else {
					console.log('Yay, the gif loaded!');
				}
			});
		</script>
```

### Image tag attributes:

* **data-animated-source** -	If this url is specified, it's loaded into the player instead of src.
					This allows a preview frame to be shown until animated gif data is streamed into the canvas

* **data-autoplay** -		Defaults to 1 if not specified. If set to zero, a call to the play() method is needed
<commit_msg>update readme with library loading<commit_after># Overview

Re-forked from BuzzFeed's libgif project (https://github.com/buzzfeed/libgif-js), which was forked from the excelent[sic] jsgif project (https://github.com/shachaf/jsgif), which was implemented as a bookmarklet to manipulate animated gifs (http://slbkbs.org/jsgif).

This is an attempt to modernize the async handling of the library (which was not very good), and also to add some features which I found useful, such as exposing the frames object with an optional data URL for each frame.
# Example

See `example.html` for some super basic examples, if you're not familiar with the library.

See `async_example.html` for tips on using this library with [async](http://caolan.github.io/async/).

See `tween_example.html` for a cool application of the library: gifs that play/rewind as you scroll the page.

Please note: examples must be loaded via a webserver, not directly from disk. I.e. http://localhost/sibgif/example.html NOT file:///sibgif/example.html. See the same-domain origin caveat at the bottom of this document for more information. I use [http-server](https://github.com/indexzero/http-server) to do this, and you should too!

There are also hosted demos at http://sibnerian.com/example.html, http://sibnerian.com/async_example.html, and http://sibnerian.com/tween_example.html.

## Class: SuperGif

### Example Usage:

```html
<img id="myImage" src="./example1_preview.gif" data-animated-source="./example1.gif"
	width="360" height="360" data-autoplay="1" />

<!-- load the library -->
<script type="text/javascript" src="js/sibgif.min.js"></script>

<script type="text/javascript">
	var gif = new SuperGif({
		gif: document.getElementById('myImage')
	});
	gif.load(function (err) {
		if (err) {
			console.error(err);
		} else {
			console.log('Yay, the gif loaded!');
		}
	});
</script>
```

### Image tag attributes:

* **data-animated-source** -	If this url is specified, it's loaded into the player instead of src.
					This allows a preview frame to be shown until animated gif data is streamed into the canvas

* **data-autoplay** -		Defaults to 1 if not specified. If set to zero, a call to the play() method is needed

{'fraction_non_alphanumeric': 0.11574074074074074, 'fraction_numerical': 0.004629629629629629, 'mean_word_length': 4.125741399762752, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1283185', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1299, 'n_words': 502}