Created
January 16, 2015 08:33
-
-
Save watert/262156780faaaa557e2c to your computer and use it in GitHub Desktop.
transition utils
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
domAnimateTo = ($dom, to)-> | |
$dom.css(cssTransition("all ease-in-out .2s")).css(to) | |
.on "-webkit-transitionEnd transitionend", ()-> $dom.css(cssTransition("")) | |
domAnimate = ($dom, from, to)-> | |
$dom.css(from) | |
setTimeout ( -> domAnimateTo($dom, to) ), 33 | |
cssTransition = (val)-> | |
"-webkit-transition": "-webkit-"+val | |
"transition": val | |
cssTranslate = (val)-> | |
"-webkit-transform": val | |
"transform": val | |
cssTranslateX = (x)-> | |
cssTranslate("translateX(#{x}px)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment