Skip to content

Instantly share code, notes, and snippets.

@drikin
Created July 25, 2009 11:30
Show Gist options
  • Save drikin/154778 to your computer and use it in GitHub Desktop.
Save drikin/154778 to your computer and use it in GitHub Desktop.
shadow animation on Drift Diary Title
var alphaCounter = 1;
var countDirection = 1;
var mainStyleSheet = document.styleSheets[0];
function getShadowCssText(alphaValue) {
return "#banner-header {text-shadow: 4px 4px 4px rgba(105, 105, 105, " + alphaValue + ") !important;}"
}
function timeout_trigger() {
if( alphaCounter < 0 || alphaCounter > 20 ) {
countDirection *= -1;
}
alphaCounter += countDirection;
mainStyleSheet.deleteRule(0)
mainStyleSheet.insertRule(getShadowCssText(alphaCounter / 10), 0)
setTimeout('timeout_trigger()', 100);
}
function timeout_init() {
mainStyleSheet.insertRule(getShadowCssText(0), 0)
timeout = setTimeout('timeout_trigger()', 100);
}
timeout_init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment