jQuery.Keyframes
This library is a wrapper around Keyframes.js, a vanilla js library that allows dynamic generation of CSS keyframes with callback events and other niceness.
Overview
CSS3 introduced fancy features like transformations, translations, rotations and scaling. jQuery has a very nice built in $(selector).animate() function which allows for easy setup of these animations. However, jQuery's animate() does not support multiple keyframes. jQuery.Keyframes helps you accomplish just that.
Requirements
Installation
Include script in your document using the following line:
Be sure to define and play animations only after the page has loaded using window.onload
.
Usage
Detecting CSS animation support
var supportedFlag = $keyframe;
Adding a new animation sequence (keyframe)
$keyframe;
Adding a single frame style
$keyframe;
Adding multiple frame styles
$keyframe;
Adding styles and properties in array fashion
Gives resemblance to CSS styling definitions
var shake_start = 'transform': 'translate(0px)';var shake_odd1 = 'transform': 'translate(-10px, -10px)';var shake_even1 = 'transform': 'translate(10px, 10px)';var shake_odd2 = 'transform': 'translate(10px, -10px)';var shake_even2 = 'transform': 'translate(-10px, 10px)'; $keyframe;
Please note, you can add as many properties to the array as you want to
Responsive animations
$keyframe;
Playing an animation
The css3 animation methods available are better documented here: http://www.w3schools.com/css/css3_animations.asp
;
Playing an animation (shorthand)
;
Playing multiple animations
;
Reset the animation
;
Freeze keyframe animation and kill callbacks
;
Resume keyframe animation
;
Who is using jQuery.Keyframes?
- Hipster Gallery: http://labs.bebensiganteng.com/html5/hipstergallery/#thumbnails/0
- Ronneby Wordpress Theme: https://themeforest.net/item/ronneby-highperformance-wordpress-theme/11776839?s_rank=1
- Brooklyn Wordpress Theme: https://themeforest.net/item/brooklyn-responsive-multipurpose-wordpress-theme/6221179
- Contrive Wordpress Theme: https://themeforest.net/item/contrive-building-construction-html5-template/14535825
- DFD-Native Wordpress Theme: https://themeforest.net/item/native-powerful-startup-development-tool/19200310
- Sunday Wordpress Theme: http://themes.dfd.name/sunday/promo/
Plugins!
See other plugins that allow for spritesheets & more complex movement paths: https://github.com/Keyframes
- Keyframes.Pathfinder: A plugin for jQuery.Keyframes that generates complex movement paths
- Keyframes.Spritesheet: Keyframes.Spritesheet easily generates css3 keyframes for elements using animated spritesheets.
Changelog
1.0.0
- Moved to use keyframes.js as a base 0.1.0
- Remove all vendor prefix functionality (if you need this stick with 0.0.9)
- Remove debug output
- Source code now in ES6
- Remove advanced example
- Add jQuery 3.x to example
- Add linting 0.0.9
- Add debug output