Skip to content

Instantly share code, notes, and snippets.

@watert
Created January 16, 2015 08:33
Show Gist options
  • Save watert/262156780faaaa557e2c to your computer and use it in GitHub Desktop.
Save watert/262156780faaaa557e2c to your computer and use it in GitHub Desktop.
transition utils
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