view on requirebin
-
-
Save itayw/7563272 to your computer and use it in GitHub Desktop.
requirebin sketch
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
<style type='text/css'> html, body { margin: 0; padding: 0; border: 0; } </style> |
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
var Spinning = require('spinning'); | |
var spinner = Spinning().text('loading...').light().size(200); | |
setTimeout(function () { | |
spinner.remove(); | |
}, 3000); |
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
require=function(t,e,n){function r(n,o){if(!e[n]){if(!t[n]){var s="function"==typeof require&&require;if(!o&&s)return s(n,!0);if(i)return i(n,!0);throw Error("Cannot find module '"+n+"'")}var c=e[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return r(i?i:e)},c,c.exports)}return e[n].exports}for(var i="function"==typeof require&&require,o=0;n.length>o;o++)r(n[o]);return r}({1:[function(t,e){e.exports=".spinner, .overlay {\n position: fixed;\n opacity: 0;\n}\n\n.spinner {\n left: 50%;\n top: 50%;\n margin-left: -100px;\n margin-top: -100px;\n z-index: 2222222222;\n}\n\n.overlay {\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: white;\n z-index: 1111111111;\n}\n"},{}],spinning:[function(t,e){e.exports=t("MiDQKA")},{}],MiDQKA:[function(t,e){(function(){function n(){function t(t){a(function(){u||(document.body.appendChild(t),f=!0)})}i(o);var e=1e3,n=300,u=!1,f=!1,d=document.createElement("div");d.className="overlay",t(d);var p=new r;p.el.className="spinner",t(p.el),c.nextTick(function(){s(d,.8,e),s.in(p.el,e)}),p.remove=function(){s.out(d,n),s.out(p.el,n),u=!0,setTimeout(function(){p.stop(),f&&(document.body.removeChild(d),document.body.removeChild(p.el))},n)};var l=p.size;p.size=function(t){return p.el.style.marginLeft=p.el.style.marginTop="-"+t/2+"px",l.call(p,t)};var h=p.light;return p.light=function(){return d.style.backgroundColor="black",h.call(p)},p["in"]=function(t){e=t},p.out=function(t){n=t},p}var r=t("spinner-browserify"),i=t("insert-css"),o=t("./style"),s=t("fade"),c=t("process"),a=t("domready");e.exports=n})()},{process:2,"./style":1,"insert-css":3,fade:4,domready:5,"spinner-browserify":6}],2:[function(t,e){(function(){var n=e.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){if(t.source===window&&"browserify-tick"===t.data&&(t.stopPropagation(),n.length>0)){var e=n.shift();e()}},!0),function(t){n.push(t),window.postMessage("browserify-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(e){if("evals"===e)return t("vm");throw Error("No such module. (Possibly not yet loaded)")},function(){var e,r="/";n.cwd=function(){return r},n.chdir=function(n){e||(e=t("path")),r=e.resolve(n,r)}}()})()},{path:7,vm:8}],9:[function(t,e){var n=e.exports={};n.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){if(t.source===window&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var e=n.shift();e()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw Error("process.chdir is not supported")}},{}],7:[function(t,e,n){(function(t){function e(t,e){for(var n=[],r=0;t.length>r;r++)e(t[r],r,t)&&n.push(t[r]);return n}function r(t,e){for(var n=0,r=t.length;r>=0;r--){var i=t[r];"."==i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var i=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){for(var n="",i=!1,o=arguments.length;o>=-1&&!i;o--){var s=o>=0?arguments[o]:t.cwd();"string"==typeof s&&s&&(n=s+"/"+n,i="/"===s.charAt(0))}return n=r(e(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var n="/"===t.charAt(0),i="/"===t.slice(-1);return t=r(e(t.split("/"),function(t){return!!t}),!n).join("/"),t||n||(t="."),t&&i&&(t+="/"),(n?"/":"")+t},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(e(t,function(t){return t&&"string"==typeof t}).join("/"))},n.dirname=function(t){var e=i.exec(t)[1]||"",n=!1;return e?1===e.length||n&&3>=e.length&&":"===e.charAt(1)?e:e.substring(0,e.length-1):"."},n.basename=function(t,e){var n=i.exec(t)[2]||"";return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){return i.exec(t)[3]||""},n.relative=function(t,e){function r(t){for(var e=0;t.length>e&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),o=r(e.split("/")),s=Math.min(i.length,o.length),c=s,a=0;s>a;a++)if(i[a]!==o[a]){c=a;break}for(var u=[],a=c;i.length>a;a++)u.push("..");return u=u.concat(o.slice(c)),u.join("/")}})(t("__browserify_process"))},{__browserify_process:9}],3:[function(t,e){var n=[];e.exports=function(t){if(!(n.indexOf(t)>=0)){n.push(t);var e=document.createElement("style"),r=document.createTextNode(t);e.appendChild(r),document.head.childNodes.length?document.head.insertBefore(e,document.head.childNodes[0]):document.head.appendChild(e)}}},{}],5:[function(t,e){!function(t,n){e!==void 0?e.exports=n():"function"==typeof define&&"object"==typeof define.amd?define(n):this[t]=n()}("domready",function(t){function e(t){for(l=1;t=r.shift();)t()}var n,r=[],i=!1,o=document,s=o.documentElement,c=s.doScroll,a="DOMContentLoaded",u="addEventListener",f="onreadystatechange",d="readyState",p=c?/^loaded|^c/:/^loaded|c/,l=p.test(o[d]);return o[u]&&o[u](a,n=function(){o.removeEventListener(a,n,i),e()},i),c&&o.attachEvent(f,n=function(){/^c/.test(o[d])&&(o.detachEvent(f,n),e())}),t=c?function(e){self!=top?l?e():r.push(e):function(){try{s.doScroll("left")}catch(n){return setTimeout(function(){t(e)},50)}e()}()}:function(t){l?t():r.push(t)}})},{}],8:[function(require,module,exports){var Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)e.push(n);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;t.length>n;n++)e(t[n],n,t)},Script=exports.Script=function NodeScript(t){return this instanceof Script?(this.code=t,void 0):new Script(t)};Script.prototype.runInNewContext=function(t){t||(t={});var e=document.createElement("iframe");e.style||(e.style={}),e.style.display="none",document.body.appendChild(e);var n=e.contentWindow;forEach(Object_keys(t),function(e){n[e]=t[e]}),!n.eval&&n.execScript&&n.execScript("null");var r=n.eval(this.code);return forEach(Object_keys(n),function(e){t[e]=n[e]}),document.body.removeChild(e),r},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInContext=function(t){return this.runInNewContext(t)},forEach(Object_keys(Script.prototype),function(t){exports[t]=Script[t]=function(e){var n=Script(e);return n[t].apply(n,[].slice.call(arguments,1))}}),exports.createScript=function(t){return exports.Script(t)},exports.createContext=Script.createContext=function(t){var e={};return"object"==typeof t&&forEach(Object_keys(t),function(n){e[n]=t[n]}),e}},{}],4:[function(t,e){function n(t,e,n){n===void 0&&(n=1e3);var i=r.get(t.style,"transition")||"";r(t.style,"transition","opacity "+n/1e3+"s"),t.style.opacity=e,setTimeout(function(){r(t.style,"transition",i)},n)}var r=t("prefixed");e.exports=n,n.out=function(t,e){n(t,0,e)},n["in"]=function(t,e){n(t,1,e)}},{prefixed:10}],6:[function(t,e){function n(){var t=this;this.percent=0,this.el=document.createElement("canvas"),this.ctx=this.el.getContext("2d"),this.size(50),this.fontSize(11),this.speed(60),this.font("helvetica, arial, sans-serif"),this.stopped=!1,function e(){t.stopped||(i(e),t.percent=(t.percent+t._speed/36)%100,t.draw(t.ctx))}()}var r=t("autoscale-canvas"),i=t("raf-component");e.exports=n,n.prototype.stop=function(){this.stopped=!0},n.prototype.size=function(t){return this.el.width=t,this.el.height=t,r(this.el),this},n.prototype.text=function(t){return this._text=t,this},n.prototype.fontSize=function(t){return this._fontSize=t,this},n.prototype.font=function(t){return this._font=t,this},n.prototype.speed=function(t){return this._speed=t,this},n.prototype.light=function(){return this._light=!0,this},n.prototype.draw=function(t){var e=Math.min(this.percent,100),n=window.devicePixelRatio||1,r=this.el.width/n,i=r/2,o=i,s=i,c=i-1,a=this._fontSize,u=this._light;t.font=a+"px "+this._font;var f=2*Math.PI*(e/100);t.clearRect(0,0,r,r);var d=t.createLinearGradient(i+Math.sin(1.5*Math.PI-f)*i,i+Math.cos(1.5*Math.PI-f)*i,i+Math.sin(.5*Math.PI-f)*i,i+Math.cos(.5*Math.PI-f)*i);u?(d.addColorStop(0,"rgba(255, 255, 255, 0)"),d.addColorStop(1,"rgba(255, 255, 255, 1)")):(d.addColorStop(0,"rgba(0, 0, 0, 0)"),d.addColorStop(1,"rgba(0, 0, 0, 1)")),t.strokeStyle=d,t.beginPath(),t.arc(o,s,c,f-Math.PI,f,!1),t.stroke(),t.strokeStyle=u?"rgba(255, 255, 255, .4)":"#eee",t.beginPath(),t.arc(o,s,c-1,0,2*Math.PI,!0),t.stroke();var p=this._text||"",l=t.measureText(p).width;return u&&(t.fillStyle="rgba(255, 255, 255, .9)"),t.fillText(p,o-l/2+1,s+a/2-1),this}},{"autoscale-canvas":11,"raf-component":12}],10:[function(t,e){function n(t,e,n){for(var i=0;r.length>i;i++)t[r[i]+e]=n}var r=["-webkit-","-moz-","-o-","-ms-",""];e.exports=n,n.get=function(t,e){for(var n=0;r.length>n;n++){var i=t[r[n]+e];if(i&&""!=i)return i}return""}},{}],11:[function(t,e){e.exports=function(t){var e=t.getContext("2d"),n=window.devicePixelRatio||1;return 1!=n&&(t.style.width=t.width+"px",t.style.height=t.height+"px",t.width*=n,t.height*=n,e.scale(n,n)),t}},{}],12:[function(t,e,n){function r(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-i));setTimeout(t,n),i=e}n=e.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||r;var i=(new Date).getTime(),o=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame;n.cancel=function(t){o.call(window,t)}},{}]},{},[]);var Spinning=require("spinning"),spinner=Spinning().text("loading...").light().size(200);setTimeout(function(){spinner.remove()},3e3); |
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
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment