daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Jan 8th, 2014 430 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:void%20function(f%2Cd%2Cc%2Cg)%7Bvar%20h%3D%7B%7D%3B(function(d)%7Bfunction%20a(a%2Cd)%7Bfunction%20b(c)%7Be%5Ba%5D.playing%26%26(d(c%2Be%5Ba%5D.iShift)%2Ce%5Ba%5D%26%26(e%5Ba%5D.frameId%3Dk(b)%2Ce%5Ba%5D.lastTime%3Dc))%7Dreturn%20b%7Dvar%20k%3D(f.requestAnimationFrame%7C%7Cf.mozRequestAnimationFrame%7C%7Cf.webkitRequestAnimationFrame%7C%7Cf.msRequestAnimationFrame%7C%7CsetTimeout).bind(f)%2Ce%3D%7B%7D%2Cb%3D0%2Cc%3D-1%3Bd.setRender%3Dfunction(d%2Cf)%7Bvar%20g%3Db%3Bf%3Df%7C%7C0%3Bb%2B%2B%3Be%5Bg%5D%3D%7BframeId%3A0%2Cplaying%3A!0%2Cthread%3Ad%2ClastTime%3A0%2Cshift%3Af%2CiShift%3Af-(Date.now()-c)%7D%3Bd%3Da(g%2Cd)%3Bk(d)%3Breturn%20g%7D%3Bd.clearRender%3Dfunction(a)%7Breturn%20e%5Ba%5D!%3D%3Dg%3F%20(e%5Ba%5D.playing%26%26cancelAnimationFrame(e%5Ba%5D.frameId)%2Ce%5Ba%5D%3Dg%2C!0)%3A!1%7D%3Bd._init%3Dfunction()%7Bvar%20a%3Dfunction()%7Breturn%20function(a)%7Bc%3DDate.now()-a%7D%7D()%3Bk(a)%7D%3Bd._init()%7D)(h)%3Bvar%20b%3Dd.getElementsByTagName(c)%5B0%5D%3Bc%3Dd.createElement(c)%3Bc.innerHTML%3D%22.negi%7Bposition%3Afixed%3Btop%3A0%3Bleft%3A0%3Bz-index%3A99999%3B%7D%22%3Bb%3D%3D%3Dg%3F(b%3Dd.getElementsByTagName(%22head%22)%5B0%5D%2Cb.appendChild(c))%3Ab.parentNode.lastChild%3D%3Db%3Fb.parentNode.appendChild(c)%3Ab.parentNode.insertBefore(c%2Cb.nextSibling)%3Bf.Negi%3Dfunction()%7Bfunction%20b()%7Bvar%20a%3Dd.documentElement%2Cc%3Dd.body%2C%20e%3Df.innerWidth%7C%7Ca.clientWidth%7C%7Cc.clientWidth%2Ca%3Df.innerHeight%7C%7Ca.clientHeight%7C%7Cc.clientHeight%3Bthis.__instance%3Dd.createElement(%22img%22)%3Bthis.__instance.setAttribute(%22class%22%2C%22negi%22)%3Bthis.__instance.style.left%3DMath.random()*e%2B%22px%22%3Bthis.__instance.style.top%3D%22-10px%22%3Bthis.__speed%3D0%3Bthis.__max_height%3Da%2B30%3Bthis.__run_times%3D0%3Bthis.__render_id%3D-1%3Bthis.__fibo%3D%5B2%2C3%2C5%2C8%2C13%2C21%2C34%2C55%2C89%5D%7Db.prototype.start%3Dfunction()%7Bthis.__instance.src%3D%22http%3A%2F%2Fanohito.tw%2Fsandbox%2Fnegi%2Fnegi%22%2BMath.ceil(6*Math.random())%2B%22.png%22%3Bd.getElementsByTagName(%22body%22)%5B0%5D.appendChild(this.__instance)%3B%20var%20a%3Dthis%3Bthis.__intervalID%3Dh.setRender(function(b)%7Bvar%20e%2Cc%2Cf%3Ba.__run_times%2B%2B%3Bc%3D0%3Bfor(f%3Da.__fibo.length%3Bc%3Cf%3Bc%2B%2B)e%3Da.__fibo%5Bc%5D%2C0%3D%3D%3Da.__run_times%25e%26%26(a.__speed%2B%3DMath.random()-0.5)%3Be%3DparseInt(a.__instance.style.left%2C10)%3Bb*%3D0.25%3Bif(300%3Ca.__run_times%7C%7Cb%3E%3Da.__max_height)return%20d.getElementsByTagName(%22body%22)%5B0%5D.removeChild(a.__instance)%2Ch.clearRender(a.__intervalID)%2C!1%3Be%2B%3D0%3Ca.__speed%3FMath.abs(a.__speed)%3A-1*Math.abs(a.__speed)%3Ba.__instance.style.left%3De%2B%22px%22%3Ba.__instance.style.top%3Db%2B%22px%22%7D)%7D%3Breturn%20b%7D()%3BsetInterval(function()%7B(new%20Negi).start()%7D%2C%20500)%7D(this%2Cthis.document%2C%22style%22)%3B
  2.  
  3.  
  4. void((function (window, document, style, undefined) {
  5.     var render = {};
  6.     (function (render) {
  7.         var requestAnimationFrame = (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || setTimeout).bind(window);
  8.         var _renderList = {};
  9.         var _renderCount = 0;
  10.         var _pageStartTime = -1;
  11.  
  12.         function _renderThreadFactory(id, renderer) {
  13.             function sRenderThread(tick) {
  14.                 if (_renderList[id].playing) {
  15.                     renderer(tick + _renderList[id].iShift);
  16.                     if(!_renderList[id]){return;}
  17.                     _renderList[id].frameId = requestAnimationFrame(sRenderThread);
  18.                     _renderList[id].lastTime = tick;
  19.                 }
  20.             }
  21.             return sRenderThread;
  22.         }
  23.         render.setRender = function setRender(renderThread, shift) {
  24.             var renderNow = _renderCount, renderThread;
  25.             shift = shift || 0;
  26.             _renderCount++;
  27.             _renderList[renderNow] = {
  28.                 frameId: 0,
  29.                 playing: true,
  30.                 thread: renderThread,
  31.                 lastTime: 0,
  32.                 shift: shift,
  33.                 iShift: shift - (Date.now() - _pageStartTime)
  34.             };
  35.             renderThread = _renderThreadFactory(renderNow, renderThread)
  36.             requestAnimationFrame(renderThread);
  37.             return renderNow;
  38.         };
  39.         render.clearRender = function clearRender(id) {
  40.             if (_renderList[id] !== undefined) {
  41.                 if (_renderList[id].playing) {
  42.                     cancelAnimationFrame(_renderList[id].frameId);
  43.                 }
  44.                 _renderList[id] = undefined;
  45.                 return true;
  46.             } else {
  47.                 return false;
  48.             }
  49.         };
  50.         render._init = function _init() {
  51.             function getFirstRender() {
  52.                 function firstThread(tick) {
  53.                     _pageStartTime = Date.now() - tick;
  54.                 }
  55.                 return firstThread;
  56.             }
  57.             var firstThread = getFirstRender();
  58.             requestAnimationFrame(firstThread);
  59.         };
  60.         render._init();
  61.     }(render));
  62.  
  63.     var s = document.getElementsByTagName(style)[0],
  64.         is = document.createElement(style);
  65.     is.innerHTML = '.negi{position:fixed;top:0;left:0;z-index:99999;}';
  66.     if (s === undefined) {
  67.         s = document.getElementsByTagName('head')[0];
  68.         s.appendChild(is);
  69.     } else {
  70.         if (s.parentNode.lastChild == s) {
  71.             s.parentNode.appendChild(is);
  72.         } else {
  73.             s.parentNode.insertBefore(is, s.nextSibling);
  74.         }
  75.     }
  76.     window.Negi = (function () {
  77.         function Negi() {
  78.             var documentElement = document.documentElement,
  79.                 body = document.body,
  80.                 width = window.innerWidth || documentElement.clientWidth || body.clientWidth,
  81.                 height = window.innerHeight || documentElement.clientHeight || body.clientHeight;
  82.             this.__instance = document.createElement('img');
  83.             this.__instance.setAttribute('class', 'negi');
  84.             this.__instance.style.left = Math.random() * width + 'px';
  85.             this.__instance.style.top = '-10px';
  86.             this.__speed = 0;
  87.             this.__max_height = height + 30;
  88.             this.__run_times = 0;
  89.             this.__render_id = -1;
  90.             this.__fibo = [2, 3, 5, 8, 13, 21, 34, 55, 89];
  91.         }
  92.         Negi.prototype.start = function () {
  93.             this.__instance.src = 'http://anohito.tw/sandbox/negi/negi' + (Math.ceil(Math.random() * 6)) + '.png';
  94.             document.getElementsByTagName('body')[0].appendChild(this.__instance);
  95.             var __this = this,
  96.                 __loop = function (time) {
  97.                     var j, _i, _len, _left, _top;
  98.                     __this.__run_times++;
  99.                     for (_i = 0, _len = __this.__fibo.length; _i < _len; _i++) {
  100.                         j = __this.__fibo[_i];
  101.                         if (__this.__run_times % j === 0) {
  102.                             __this.__speed += Math.random() - 0.5;
  103.                         }
  104.                     }
  105.                     _left = parseInt(__this.__instance.style.left, 10);
  106.                     _top = time * 0.25;
  107.                     if (__this.__run_times > 300 || _top >= __this.__max_height) {
  108.                         document.getElementsByTagName('body')[0].removeChild(__this.__instance);
  109.                         render.clearRender(__this.__intervalID);
  110.                         return false;
  111.                     }
  112.                     _left += __this.__speed > 0 ? Math.abs(__this.__speed) : Math.abs(__this.__speed) * -1;
  113.                     __this.__instance.style.left = _left + 'px';
  114.                     __this.__instance.style.top = _top + 'px';
  115.                 };
  116.             this.__intervalID = render.setRender(__loop);
  117.         };
  118.         return Negi;
  119.     })();
  120.     setInterval(function () {
  121.         (new Negi()).start();
  122.     }, 500);
  123. })(this, this.document, 'style'));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top