Created
April 22, 2011 04:39
-
-
Save VoQn/936030 to your computer and use it in GitHub Desktop.
Generate CSS3 Transition Properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var animateCSS; | |
animateCSS = function(css, duration, timing_function, delay) { | |
var animate, browser, obj, property, value, _i, _len, _ref; | |
if (duration == null) { | |
duration = '1s'; | |
} | |
if (timing_function == null) { | |
timing_function = 'linear'; | |
} | |
if (delay == null) { | |
delay = 0; | |
} | |
obj = {}; | |
if (css != null) { | |
animate = ''; | |
for (property in css) { | |
value = css[property]; | |
obj[property] = value; | |
if (animate !== '') { | |
animate += ', '; | |
} | |
animate += "" + property + " " + duration + " " + timing_function + " " + delay; | |
} | |
if (animate !== '') { | |
_ref = ['', '-o-', '-moz-', '-webkit-']; | |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | |
browser = _ref[_i]; | |
obj["" + browser + "transition"] = animate; | |
} | |
} | |
} | |
return obj; | |
}; | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment