An open API service indexing awesome lists of open source software.

https://github.com/soixantecircuits/vue-sprite-animator

vue.js component for animating spritesheets
https://github.com/soixantecircuits/vue-sprite-animator

Last synced: about 2 months ago
JSON representation

vue.js component for animating spritesheets

Awesome Lists containing this project

README

        

# vue-sprite-animator

## Install

Install with npm or yarn:

```sh
$ npm install --save vue-sprite-animator
# or
$ yarn add vue-sprite-animator
```

## Example

> Use [spritesheet.js](https://github.com/krzysztof-o/spritesheet.js/) to generate spritesheet with the `jsonarray` format.

#### Install the plugin

```js
import Vue from 'vue'
import App from './App'

import VueSpriteAnimator from 'vue-sprite-animator'
Vue.use(VueSpriteAnimator)

new Vue({
components: { App },
template: ''
}).$mount('#app')
```

#### Use it

```vue



play
stop

export default {
methods: {
play () {
this.$refs.sprite.play()
},
stop () {
this.$refs.sprite.stop()
}
}
}

```

## Available props

* `spritesheet` *(required)*: path to the spritesheet image
* `json` *(required)*: path to the spritesheet json descriptor (use [spritesheet.js](https://github.com/krzysztof-o/spritesheet.js/))
* `fps`: default is `30`
* `autoplay`: default is `true`
* `yoyo`: default is `false`
* `id`: default is `vue-sprite`