diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-06-21 00:50:15 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-06-21 00:50:15 +0200 |
| commit | 0b854ecccfe7832ba9a837605822a103fd9d8bc0 (patch) | |
| tree | d4a11b5677ff96618d29b114e43d25a334f66412 /public/assets/js/vendor/confetti.js | |
| parent | fbbb3a348018081bb2a89439eb3275153105d2e0 (diff) | |
clearing out old code
Diffstat (limited to 'public/assets/js/vendor/confetti.js')
| -rw-r--r-- | public/assets/js/vendor/confetti.js | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/public/assets/js/vendor/confetti.js b/public/assets/js/vendor/confetti.js deleted file mode 100644 index 3abb2e5..0000000 --- a/public/assets/js/vendor/confetti.js +++ /dev/null @@ -1,124 +0,0 @@ -var made_confetti = false -var confetti_on = true -function MAKE_CONFETTI() { - if (made_confetti) return - made_confetti = true - - var COLORS, Confetti, NUM_CONFETTI, PI_2, canvas, confetti, context, drawCircle, i, range, resizeWindow, xpos; - - NUM_CONFETTI = 350; - - COLORS = [[254, 163, 170], [248, 184, 139], [250, 248, 132], [186, 237, 145], [178, 206, 254], [242, 162, 232]]; - - PI_2 = 2 * Math.PI; - - var canvas = document.createElement("canvas") - $("#rapper").append(canvas) - - if (! canvas) return; - - context = canvas.getContext("2d"); - - window.w = 0; - - window.h = 0; - - resizeWindow = function() { - window.w = canvas.width = window.innerWidth; - return window.h = canvas.height = window.innerHeight; - }; - - window.addEventListener('resize', resizeWindow, false); - - setTimeout(resizeWindow, 0); - - range = function(a, b) { - return (b - a) * Math.random() + a; - }; - - drawCircle = function(x, y, r, style) { - context.beginPath(); - context.arc(x, y, r, 0, PI_2, false); - context.fillStyle = style; - return context.fill(); - }; - - xpos = 0.5; - - document.onmousemove = function(e) { - return xpos = e.pageX / w; - }; - - window.requestAnimationFrame = (function() { - return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { - return window.setTimeout(callback, 1000 / 60); - }; - })(); - - Confetti = (function() { - function Confetti() { - this.style = COLORS[~~range(0, 5)]; - this.rgb = "rgba(" + this.style[0] + "," + this.style[1] + "," + this.style[2]; - this.r = ~~range(2, 6); - this.r2 = 2 * this.r; - this.replace(); - } - - Confetti.prototype.replace = function() { - this.opacity = 0; - this.dop = 0.03 * range(1, 4); - this.x = range(-this.r2, w - this.r2); - this.y = range(-20, h - this.r2); - this.xmax = w - this.r; - this.ymax = h - this.r; - this.vx = range(0, 2) + 8 * xpos - 5; - return this.vy = 0.7 * this.r + range(-1, 1); - }; - - Confetti.prototype.draw = function() { - var ref; - this.x += this.vx; - this.y += this.vy; - this.opacity += this.dop; - if (this.opacity > 1) { - this.opacity = 1; - this.dop *= -1; - } - if (this.opacity < 0 || this.y > this.ymax) { - this.replace(); - } - if (!((0 < (ref = this.x) && ref < this.xmax))) { - this.x = (this.x + this.xmax) % this.xmax; - } - return drawCircle(~~this.x, ~~this.y, this.r, this.rgb + "," + this.opacity + ")"); - }; - - return Confetti; - - })(); - - confetti = (function() { - var j, ref, results; - results = []; - for (i = j = 1, ref = NUM_CONFETTI; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) { - results.push(new Confetti); - } - return results; - })(); - - confetti_step = function() { - var c, j, len, results; - requestAnimationFrame(confetti_step); - if (! confetti_on) return - context.clearRect(0, 0, w, h); - results = []; - for (j = 0, len = confetti.length; j < len; j++) { - c = confetti[j]; - results.push(c.draw()); - } - return results; - }; - - confetti_step(); - -}
\ No newline at end of file |
