Created
June 9, 2013 16:50
-
-
Save TimPietrusky/5744234 to your computer and use it in GitHub Desktop.
A CodePen by Tim Pietrusky. fucking flashlight - You're at the club and see the fucking flashlight... what do you gonna do?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
fucking flashlight | |
2012 by Tim Pietrusky | |
timpietrusky.com | |
--> | |
<!-- | |
You can click the flashlight (anywhere) to toggle start/stop | |
--> | |
<body title="click to toggle on/off"></body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var _body = $('body'), | |
_interval, | |
random_content, | |
random_content_lastValue, | |
content = new Array( | |
"☀","☁","☂","☃","☄","★","☆","☎","☔","☕","☘","☚","☛","☠","☢","☣","☤","☥","☪","☭","☮","☯","☹","☺","♆","♛","♚","♜","♝","♞","♠","♣","♥","♦","♨","♫","♪","♿","♰","♿","♲","⚃","⚅","⚛","⚙","⚝","⚜","⚡","⚑","⚒","⚓","⚔","⚕","⚖","⛃","✆","✇","✈","✩","✪","✫","✬","✭","✮","✯", "Knife Party", "visual vomit", "Pinky", "rockst★r", "Supershirt", "Frittenbude", "SICK SLAUGHTERHOUSE", "DJ Hype", "edecay", "dnb", "dubstep", "minimal", "crackhouse", "CSS3", "HTML5", "codepen", "Borgore", "Buygore", "DJCHUCKIE", "zinc", "smashing magazine", "github", "eclipse", | |
"box-model", "get your shit together", "wtf", "fucking", "flashlight"); | |
// start the fucking flashlight | |
_body.addClass('flash'); | |
// start changing everything | |
startChanging(); | |
// start/stop flashing | |
$('body').click(function() { | |
if (_body.hasClass('flash')) { | |
_body.removeClass('flash'); | |
} else { | |
_body.addClass('flash'); | |
} | |
}); | |
function startChanging() { | |
setInterval(function() { | |
random_content = randomBetween(content.length); | |
if (_body.hasClass('flash')) { | |
_body.html(content[random_content]); | |
} else { | |
_body.html(""); | |
} | |
}, 315); | |
}; | |
function randomBetween (max) { | |
var r; | |
do {r = Math.random();} while(r == 1.0); | |
return parseInt(r * max); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* fucking flashlight | |
* | |
* | |
* 2012 by tim-pietrusky.de | |
* | |
* Licensed under VVL 1.33b7 - tim-pietrusky.de/license | |
*/ | |
@import url(http://fonts.googleapis.com/css?family=Codystar); | |
html, | |
body { | |
border-width: 0px; | |
height:100%; | |
width:100%; | |
margin:0; | |
padding:0; | |
text-align:center; | |
background:#000; | |
overflow:hidden; | |
font:4em 'Codystar', cursive; | |
cursor:crosshair; | |
} | |
body { | |
padding-top:5px; | |
} | |
/* | |
* and this is all the flashlight magic | |
*/ | |
body.flash { | |
-webkit-animation: flash .35s infinite linear forwards; | |
-moz-animation: flash .35s infinite linear forwards; | |
-ms-animation: flash .35s infinite linear forwards; | |
-o-animation: flash .35s infinite linear forwards; | |
} | |
@-webkit-keyframes flash { | |
0% {background: #fff;} | |
25% {background: #000;} | |
} | |
@-moz-keyframes flash { | |
0% {background: #fff;} | |
25% {background: #000;} | |
} | |
@-ms-keyframes flash { | |
0% {background: #fff;} | |
25% {background: #000;} | |
} | |
@-o-keyframes flash { | |
0% {background: #fff;} | |
25% {background: #000;} | |
} | |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment