Skip to content

Instantly share code, notes, and snippets.

@skmp
Last active August 29, 2015 13:56
Show Gist options
  • Save skmp/8983448 to your computer and use it in GitHub Desktop.
Save skmp/8983448 to your computer and use it in GitHub Desktop.
Lets glitch that html
//paste into console, in ex. twitter.com or http://api.jquery.com/remove/ or ...
$('<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>').appendTo('body'); (function( $) {
var r=Math.random; Math.random = function() { return r()*1.3 -0.3; };items=$('body *').map(function(k,v) {
return ($.extend($(v).offset(), {$el: $(v ), background: $(v).css('background'), width: $(v).width(), height:
$(v).height()})); }); items.each(function(v,k) { k.$el.remove(); $('body').append(k.$el); k.$el.css({position:
"absolute", top: k.top, left: k.left, width: k.width, height: k.height, overflow: "hidden", power: (Math.random() -0.2)*
10}); }); setInterval(function() { items.each(function(v,k) { if (Math.random() > 0.9) { if (Math.random() > 0.8) {
k.$el.css({background: (function() { return "#" + Math.round(Math.random() * 999999); })()}) } else {
k.$el.css({background: k.background}) } }; if (Math.random() > 0.7) { k.$el.css({top:k.top +
Math.random()*10 * k.power*tp, left: k.left + Math.random()*10*tp, width: k.width + k.power*10* Math.random()*tp,
height: k.height + tp*10*Math.random()}); } });tp+=0.7;tp=tp<0.2?0.2:(tp>100?100:tp); },
10); tp=0; oldx=0;oldy=0; console.log("hello there"); $('body').on('mousemove', function(e ) { var d =
Math.sqrt((e.clientX-oldx)*(e.clientX-oldx), (e.clientY-oldy)*(e.clientY-oldy)); oldx=e.clientX; oldy=e.clientY; tp-=d/3;
tp=tp<0.2?0.2:(tp>100?100:tp);}); })($.noConflict())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment