Advertisement
B1KMusic

Let it Snow minified: improved

Jan 29th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:!function(n){function e(){function e(){r=t(i(n.window.innerWidth)),c=-10,d=i(5),l={x:i(2),y:d},i(1)<.5&&(l.x*=-1)}function o(){return 0>r||r>n.window.innerWidth||c>n.window.innerHeight}function a(){return r+=l.x,c+=l.y,u.setColor(n.flakeColor).circle(r,c,d),o()?!1:!0}var r,c,d,l;e(),this.run=a}function t(n){return Math.floor(n)}function i(n){return Math.random()*n}function o(n){return n.run()}function a(){f.length>n.maxFlakes&&f.splice(0,1)}function r(){u.clear(),f.push(new e),f=f.filter(o),a()}function c(){var e=document.createElement("script");e.src=n.libCanvas,document.body.appendChild(e),e.onload=d}function d(){u=(new Canvas.Canvas2D).setSize(n.window.innerWidth,n.window.innerHeight).setWindowWatch().setStyle("position","fixed").setStyle("left",0).setStyle("top",0).setStyle("z-index",100),setInterval(r,1e3/n.fps)}function l(n){var e=document.createElement("style");e.innerHTML=n,document.body.appendChild(e)}function s(){l("*{ margin: 0; padding: 0; }"),c()}var u,f=[];"complete"===document.readyState?s():n.window.onload=s}({window:window,libCanvas:"https://gitlab.com/bradenbest/libcanvas/raw/master/canvas.js",flakeColor:"white",fps:30,maxFlakes:200});void(0);
  2.  
  3. // Let it Snow: Improved!
  4. // 1. Paste this into the URL above (the address bar).
  5. // 2. (IMPORTANT) Make sure the "javascript:" part at the beginning survives the copy/paste. Browsers tend to remove it automatically
  6. // 3. Hit enter.
  7. // 4. Enjoy snow.
  8.  
  9. // Source: https://gitlab.com/snippets/14259
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement