Skip to content

Instantly share code, notes, and snippets.

@francescoagati
Created February 1, 2013 18:19
Show Gist options
  • Save francescoagati/4693059 to your computer and use it in GitHub Desktop.
Save francescoagati/4693059 to your computer and use it in GitHub Desktop.
play with async.js e move.js for sequence animations
$(document).ready ->
wait = (n) -> (next) -> setTimeout (-> next(null) ), n
waitFor = (fn) -> (next) -> fn(next)
moveGenerator =
(action) ->
(selector,args...) ->
(next) ->
mover = move(selector)
mover[action].apply(mover,args).end ->
next(null)
to = moveGenerator 'to'
rotate = moveGenerator 'rotate'
scale = moveGenerator 'scale'
set = moveGenerator 'set'
async.waterfall [
to "ss",10,10
waitFor (next) -> console.log "1"; next(null)
to "ss",20,20
wait 1000
waitFor (next) ->
async.waterfall [
to "ss1", 50,50
wait 1000
to "ss2",50,50
], ->
next(null)
set "ss", 'background-color', 'red'
to "ss",30,30
waitFor (next) ->
console.log "1"
next(null)
wait 5000
waitFor (next) ->
console.log "1"
next(null)
to "ss",130,130
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment