Skip to content

Instantly share code, notes, and snippets.

@meoooh
Last active December 25, 2015 04:09
Show Gist options
  • Save meoooh/6915131 to your computer and use it in GitHub Desktop.
Save meoooh/6915131 to your computer and use it in GitHub Desktop.
function twinkle(target){
var opa = $(target).css("opacity");
if(twinkleSwitch){
$(target).css("opacity", parseFloat(opa) - 0.1);
if($(target).css("opacity") < 0.1){
twinkleSwitch = false;
}
}
else{
$(target).css("opacity", parseFloat(opa) + 0.1);
if($(target).css("opacity") == 1){
twinkleSwitch = true;
}
}
}
var twinkleSwitch = true;
setInterval(function(){
twinkle("img#sample");
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment