Skip to content

Instantly share code, notes, and snippets.

@tdreyno
Created March 14, 2012 20:34
Show Gist options
  • Save tdreyno/2039309 to your computer and use it in GitHub Desktop.
Save tdreyno/2039309 to your computer and use it in GitHub Desktop.
deferreds = for c, j in @colorControls
cPoint = @controlPosition(c, center, (c.distance - 30), c.angle)
c.append()
c.elem.css(
scale: 0.3
opacity: 0
position: "absolute"
left: 0
top: 0
translateX: cPoint.x
translateY: cPoint.y
).show()
new $.Deferred()
controlScale = @controlScale
for c, i in @colorControls
cPoint = @controlPosition(c, center, c.distance, c.angle)
do (c, cPoint, i, controlScale) ->
setTimeout ->
c.elem.stop().animate { scale: controlScale, opacity: 1, translateY: cPoint.y, translateX: cPoint.x }, 200, "easeOutBack", -> deferreds[i].resolve()
, 50 * i
$.when.apply(null, deferreds).done -> cb?()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment