Skip to content

Instantly share code, notes, and snippets.

@nesk
Forked from 140bytes/LICENSE.txt
Created May 30, 2011 06:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nesk/998525 to your computer and use it in GitHub Desktop.
Save nesk/998525 to your computer and use it in GitHub Desktop.
Get ready to go epileptic !
// Function applying a blink animation on a HTML object collection. The speed of the animation is decreased by 1 millisecond for each new HTML object.
function (
a, // An array of HTML objects
b, // Minimum value to use for the setInterval() timer
c, // Placeholder
i // Placeholder
) {
for(i = 0 ; c = a[i++] ;) // Browses all the HTML objects
!function( // Closure : part 1
d, // Actual HTML object
e // Placeholder : static boolean used to know if we have to display/hide the HTML object
) {
setInterval( // Creates an interval for each HTML object
function() { // Closure : part 2
d.style.visibility = (e = !e) ? 'visible' : 'hidden'; // "visibility" CSS property switching between "hidden" and "visible" values
},
i + (b||20) // personnal setInterval() timer, avoiding a value under 20 millisecondes
);
}(c); // Sending the actual HTML object to the closure
}
// Examples of use :
// Applying the animation on all the <DIV> on the page. One cycle of each animation will take a minimum of 1000 milliseconds to execute.
(/* 140 bytes code above */)(document.getElementsByTagName('div'), 1000);
// Shitstorm incoming :
//
// O o
// /¯________________________
// | IMMA FIRIN' MAH LAZOR!!!
// \_¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//
(/* 140 bytes code above */)(document.getElementsByTagName('*'));
function(a,b,c,i){for(i=0;c=a[i++];)!function(d,e){setInterval(function(){d.style.visibility=(e=!e)?'visible':'hidden'},i+(b||20))}(c)}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Johann PARDANAUD : http://plune.fr
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "Epileptic Way",
"description": "Get ready to go epileptic !",
"keywords": [
"epilepsy",
"animation",
"blink",
"DOM",
"CSS"
]
}
<!DOCTYPE html>
<title>CSS 3 Transitions Detector</title>
<div>Expected value: <b>S</b><b>h</b><b>i</b><b>t</b><b>s</b><b>t</b><b>o</b><b>r</b><b>m</b></div>
<div>Actual value: <b>S</b><b>h</b><b>i</b><b>t</b><b>s</b><b>t</b><b>o</b><b>r</b><b>m</b><b>,</b> <b>y</b><b>e</b><b>a</b><b>h</b> <b>!</b></div>
<script>
var epilepticWay = function(a,b,c,i){for(i=0;c=a[i++];)!function(d,e){setInterval(function(){d.style.visibility=(e=!e)?'visible':'hidden'},i+(b||20))}(c)};
epilepticWay(document.getElementsByTagName('*'));
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment