Skip to content

Instantly share code, notes, and snippets.

@j03m
Last active December 28, 2015 08:48
Show Gist options
  • Save j03m/7473710 to your computer and use it in GitHub Desktop.
Save j03m/7473710 to your computer and use it in GitHub Desktop.
bindalicious
/*Expected usage:
var swapFade = jc.swapFade.bind(this);
swapFade(this.statsFrame.card, card);
Or
this.swapFade = jc.swapFade.bind(this);
*/
jc.swapFade = function(swapOut, swapIn){
if (swapOut){
jc.fadeOut(swapOut, jc.defaultTransitionTime/4, function(){
this.removeChild(swapOut);
doFadeIn.bind(this)();
}.bind(this));
}else{
doFadeIn.bind(this)();
}
function doFadeIn(){
swapIn.setOpacity(0);
this.addChild(swapIn);
jc.fadeIn(swapIn, 255, jc.defaultTransitionTime/4);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment