Parse a valid css keyframe string into a Keyframe Object for the Web Animations API
npm install keyframe-parserParse a valid css keyframe string into a Keyframe Object for the Web Animations API.
``js
var keyframe = require('keyframe-parser')
var animation = require('nanoanimation')
var move = animation(keyframe@keyframes move {
from {
top: 0px;
},
to {
top: 100px;
}
}, 1000)
move(document.getElementById('elem'), () => console.log('done'))
``
A single function is exported and is a [tagged template literal][tagged_templates].
Pass in a string for a css keyframe animation definition, and it will return a [Keyframe Object][keyframe_formats]
to be used with the [Web Animation API][web_animation].
[tagged_templates]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_templates
[keyframe_formats]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats
[web_animation]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Using_the_Web_Animations_API