Skip to content

Instantly share code, notes, and snippets.

@s6577t
Created July 4, 2014 10:20
Show Gist options
  • Select an option

  • Save s6577t/a750bb595d780e3074d8 to your computer and use it in GitHub Desktop.

Select an option

Save s6577t/a750bb595d780e3074d8 to your computer and use it in GitHub Desktop.
Trip
function trip (s) {
if ('tripIntervalId' in window) {
clearInterval(window.tripIntervalId);
}
var filters = ['invert(100%)', 'none']
var counter = 0;
function swap() {
var i = counter % 2;
counter++;
document.body.style.webkitFilter = filters[i];
}
window.tripIntervalId = setInterval(swap, s || 60);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment