Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save to/3332189 to your computer and use it in GitHub Desktop.
Save to/3332189 to your computer and use it in GitHub Desktop.
Vapor Strobes
// ==UserScript==
// @id vapor.strobes-34539d25-662b-4891-877a-706e35258457@scriptish
// @name Vapor Strobes
// @version 1.0
// @namespace to.tumblr.com
// @author to
// @include *
// @run-at document-end
// ==/UserScript==
var SHUT_TIME = 50;
var MAX_INTERVAL = 3000;
var SLICE = 25;
var intervals = [];
for(var i=SLICE ; i>=0 ; i--)
intervals.push((Math.pow(i / SLICE, 3) * MAX_INTERVAL | 0) + 40);
[].push.apply(intervals, intervals.slice(0).reverse());
var shutter = document.createElement('div');
var style = shutter.style;
with(style){
top = 0;
bottom = 0;
left = 0;
right = 0;
position = 'fixed';
background = 'black';
margin = 0;
zIndex = 9999999999;
pointerEvents = 'none';
visibility = 'hidden';
}
document.documentElement.appendChild(shutter);
var interval;
var index = 0;
(function shut(){
interval = intervals[index];
index = (index + 1) % intervals.length;
setTimeout(function(){
style.visibility = 'visible';
setTimeout(function(){
style.visibility = 'hidden';
shut();
}, SHUT_TIME);
}, interval);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment