Skip to content

Instantly share code, notes, and snippets.

@d4rekanguok
Created March 15, 2018 05:15
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 d4rekanguok/95749dafe5ecddc3eac1bf1784b210ea to your computer and use it in GitHub Desktop.
Save d4rekanguok/95749dafe5ecddc3eac1bf1784b210ea to your computer and use it in GitHub Desktop.
Layer::chain = (options...) ->
layer = @
options.reduce (promise, option) ->
promise.then () ->
new Promise (resolve) ->
layer.animate option
layer.once Events.AnimationEnd, () ->
resolve()
, Promise.resolve()
box = new Layer
backgroundColor: 'blue'
box.chain {backgroundColor: 'red'},
{x: 100},
{y: 200, backgroundColor: 'blue'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment