Skip to content

Instantly share code, notes, and snippets.

@dustinpoissant
dustinpoissant / animateTransform.jquery.js
Last active July 2, 2018 20:46
jQuery Plugin to Animate Transforms
$.fn.animateTransform = function(/* [start,] end [, duration] [, callback] */){
var start = null, end = null, duration = 400, callback = function(){};
for(var i=0; i<arguments.length; i++){
if(typeof(arguments[i]) == "string"){
if(!start) start = arguments[i];
else end = arguments[i];
} else if(typeof(arguments[i]) == "number"){
duration = arguments[i];
} else if(typeof(arguments[i]) == "function"){
callback = arguments[i];