<commit_before># Sprites

Sprites is a small JavaScript library to run sprites on HTML Canvas

# TBA<commit_msg>Add installation, usage and contributing instructions on README.md<commit_after># Sprites

Sprites is a very lightweight JavaScript library to run sprites on HTML Canvas ([Live Demo](http://nihey.github.io/sprites/))

# Installation

You can easily get it from [bower](https://github.com/bower/bower):
```
$ bower install sprites-js --save
```

# Usage

Basically you can build a sprite by instantiating the Sprite class
```
var sprite = new Sprite(options)
```
You should pass some arguments to Sprite, so that it can know:
```
  // (r) = required
  // (d N) = defaults to N
  var sprite = new Sprite({
    canvas: document.getElementById('canvas'), // Where to draw? (r)
    image: document.getElementById('image'),   // What image to use? (r)
    rows: 4,           // How many rows are there in the image?
    columns: 3,        // How many columns are there in the image?
    rowIndex: 0,       // Where to start drawing the row? (d 0)
    columnIndex: 0,    // Where to start drawing the column? (d 0)
    rowFrequency: 1,   // After how many draw cycles row is updated? (d 0)
    columnFrequency: 1,// After how many draw cycles column is updated? (d 0)
    rowCircular: true,    // true  -> 0, 1, 2, 0, 1, 2, 0, 1, 2... (d fls)
    columnCircular: true, // false -> 0, 1, 2, 1, 0, 1, 2, 1, 0... (d fls)
    rowDirection: 4,   // row increment (d 1)
    columnDirection: 4,// column increment (d 1)
    width: 100,        // Drawing width (d (image.width / columns))
    height: 100,       // Drawing height (d (image.height / rows))
  })
```
After that, you can draw your sprite
```
// x, y are the coordinates where the sprite should be drawed on the canvas
sprite.draw(x, y)
```

# Contributing

I recommend following some guidelines:

  * Keep it simple, the project should be lightweight
  * 2 space indentation
  * No trailling white spaces

# License

Sprite is released under the [MIT License](http://www.opensource.org/licenses/MIT)
{'fraction_non_alphanumeric': 0.11796116504854369, 'fraction_numerical': 0.018932038834951457, 'mean_word_length': 3.009727626459144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '1578937', 'n_tokens_mistral': 690, 'n_tokens_neox': 624, 'n_words': 272}