Skip to content

Instantly share code, notes, and snippets.

@tatey
Created July 8, 2014 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatey/3f1933d2d6d8b4dbe801 to your computer and use it in GitHub Desktop.
Save tatey/3f1933d2d6d8b4dbe801 to your computer and use it in GitHub Desktop.
app = angular.module 'dashboard'
app.animation '.appear', [->
addClass: (element, className, done) ->
$element = jQuery element
$element.removeClass className
$element.css 'opacity', 1
$element.animate {opacity: 0}, 300, 'linear', ->
$element.addClass className
done()
(isCancelled) ->
$element.stop() if isCancelled
removeClass: (element, className, done) ->
$element = jQuery element
$element.css 'opacity', 0
$element.animate {opacity: 1}, 200, 'linear', done
(isCancelled) ->
$element.stop() if isCancelled
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment