Skip to content

Instantly share code, notes, and snippets.

@Firsh
Created July 7, 2016 18:47
Show Gist options
  • Save Firsh/b017e0c95cffd3dc6ce03348f05442c6 to your computer and use it in GitHub Desktop.
Save Firsh/b017e0c95cffd3dc6ce03348f05442c6 to your computer and use it in GitHub Desktop.
jQuery v3 compatibility hack against jQuery easing v1.3
// jQuery v3 *requires* easing functions in this new format..
// if the site uses old (pre-v1.4) jQuery easing plugins, animations don't work, hence the need to create JIG's own
// jQuery v1-v2 uses the new format but is fine with the legacy format too..
$.extend( $.easing, {
// opacity changes and fades are fine with swing
JIGswing: function(p) {
return 0.5 - Math.cos(p*Math.PI)/2;
},
// for 2D movements
JIGeaseInOutQuad: function(x) {
return x < 0.5 ? 2*x*x : 1-Math.pow(-2*x+2, 2)/2;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment