sprite.js is a small JavaScript library for simple but powerful sprite based animations. It takes an element, and changes the background position to create an animation effect.
sprite.js is chained to the requestAnimationFrame
(with a polyfill for older browsers) and optimized for speed and garbage collection. What sprite.js does, cannot be done faster.
That being said, animating the element background is not the fastest possible way how to do this kind of animations (canvas solutions are faster), but it is sure as hell the most simple one, and compatible with everything from IE6 and up.
sprite.js has no dependencies.
Works everywhere.
Documentation is centralized in the gh-page, which makes it way easier to maintain and keep always up to date. Only available in Portuguese yet, but there is an of examples collection available here.
bower install --save-dev sprite=adriancmiranda/sprite.js
Clone a copy of the main sprite.js git repo by running:
git clone git@github.com:adriancmiranda/sprite.js.git && cd sprite.js
Run the build script:
npm run build
The built version of sprite.js will be put in the dist/
subdirectory, along with the minified copy and associated map file.
Use this URL for dev/testing
<script src="https://rawgit.com/adriancmiranda/sprite.js/master/dist/sprite.min.js"></script>
Use this URL in production
<script src="https://cdn.rawgit.com/adriancmiranda/sprite.js/master/dist/sprite.min.js"></script>