effected.js
animation events use as Promises or callback
Installation
$ npm install effected
Usage
<script src="effected.min.js"></script>
Example
effected(element).then(function() {
console.log('end of animation');
element.classList.remove('js-animation-move');
});
element.classList.add('js-animation-move');
Functions
effected(element[, eventType][, callback])
element
eventType
callback
for animationend, transitionend or animationstart.
return Promise if not passed callback, but throw error if cannot use Promise.
values for eventType are below:
- animationstart
- animation|animationend
- transition|transitionend
- any other
- add to animationend and transitionend
effected.iterated(element, callback)
for animationiteration.
effected.effected
alias of effected().
effected.Promise
effected use native Promise if the browser has it.
if you want to use third party Promises library, set to this property.
License
The MIT license. Please see LICENSE file.