darsain/motio
소개
스프라이트 기반 애니메이션과 패닝을 위한 소형 JavaScript 라이브러리입니다.
창작 및 미디어측정된 스타 증가
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalMotio
Small JavaScript library for simple but powerful sprite based animations and panning.
Motio takes an element and animates its background position to create an animation effect. All is super optimized for speed and chained to the requestAnimationFrame, with a polyfill for older browsers without it.
That being said, animating the element background is not the fastest possible way how to do this (canvas solutions are a lot faster), but it is sure as hell the most simple one, and compatible with everything from IE6 and up.
Dependencies
Motio has no dependencies, but there is an optional Motio jQuery plugin extension available.
Compatibility
Works everywhere.
Usage
Sprite animation mode:
var element = document.querySelector('#sprite');
var sprite = new Motio(element, {
fps: 10,
frames: 14
});
sprite.play(); // start animation
sprite.pause(); // pause animation
sprite.toggle(); // toggle play/pause
sprite.toStart(); // animate to 1st frame and stop
sprite.toEnd(); // animate to last frame and stop
sprite.to(10); // animate to 11th frame and stop
Seamless background panning mode:
var element = document.querySelector('#panning');
var panning = new Motio(element, {
fps: 30, // Frames per second. More fps = higher CPU load.
speedX: -30 // Negative horizontal speed = panning to left.
});
panning.play(); // start animation
panning.pause(); // pause animation
panning.toggle(); // toggle play/pause
Download
Latest stable release:
- Production
motio.min.js- 3KB, 1.6KB gzipped - Development
motio.js- 12KB
jQuery plugin version:
- Production
jquery.motio.min.js- 3.7KB, 1.8KB gzipped - Development
jquery.motio.js- 13.5KB
When isolating issues on jsfiddle, you can use this URL:
Documentation
Can be found in the docs directory.
Contributing
Please, read the Contributing Guidelines for this project.
관련 프로젝트 살펴보기
불러오는 중…