CSS3 Animation Helpers for JS
Bedazzle is a JS animation library that allows you to do some pretty
tricky stuff without much effort. It's quite similar to
move.js but uses a frames rather
Additionally, bedazzle is more or less a pure CSS manipulation library and doesn't support the additional easing functions that move does. It does work in partnership with your CSS though and aligns animation frames with your transition delays in the CSS (which is pretty neat).
Consider the following example, which animates a series of divs. First we have some stripped down html:
Then some css which is used across most of the examples:
Finally, a little bit of browserifiable css to make it all work:
var bedazzle = require'bedazzle';bedazzle'.box'framethisx200y200rotate-45;framethisx-200opacity0.2framethisx200y50rotate315height-100set'opacity' 1;
Create a new
Bedazzler instance which is used to orchestrate the
animation of the supplied
elements (or those elements matched by the
selector referred to by elements if it is a string).
Define a new frame in the animation loop. If an action function is
supplied, then it will be called (with
this bound to the Bedazzler) once
the frame becomes active.
Once the current frame has completed, trigger the supplied function.
When all of the defined frames have completed, restart from the beginning. An example of using loop can be found in the 'loopy' example, shown below:
var bedazzle = require'bedazzle';var stylar = require'stylar';stylarelements0set'background' 'blue';bedazzle'.spinner'framethisx50rotate180;nextColorelements;loop;
Copyright (c) 2013 Damon Oehlman email@example.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.