-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.min.js.map
1 lines (1 loc) · 9.6 KB
/
bundle.min.js.map
1
{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","bundle.min.js","source/scripts/main.js","source/scripts/particles.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length","/Users/jonasschmitt/dev/labs/source/scripts/main.js","module","./particles","/Users/jonasschmitt/dev/labs/source/scripts/particles.js","_classCallCheck","instance","Constructor","TypeError","canvas","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","Canvas","this","opts","width","height","particleCount","sizes","colors","active","particles","document","querySelector","ctx","getContext","initializeParticles","drawParticles","requestAnimationFrame","animateParticles","bind","value","p","Particle","push","draw","move","boundaryCheck","clearRect","that","deactivate","setTimeout","clearCanvas","updateParticles","context","colorRand","Math","floor","random","sizeRand","color","size","console","log","x","y","vx","vy","direction","save","beginPath","translate","fillStyle","arc","PI","fill","restore","axis","changeDirection"],"mappings":"CAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAK,GAAA,GAAAC,OAAA,uBAAAN,EAAA,IAAA,MAAAK,GAAAE,KAAA,mBAAAF,EAAA,GAAAG,GAAAX,EAAAG,IAAAS,WAAAb,GAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,GAAAE,GAAAD,EAAAI,GAAA,GAAAL,EAAA,OAAAI,GAAAF,EAAAA,EAAAF,IAAAa,EAAAA,EAAAC,QAAAd,EAAAC,EAAAC,EAAAC,GAAA,MAAAD,GAAAG,GAAAS,QAAA,IAAA,G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MErCW,WACPlB,KAAKyC,GAAqB,IAAhBzC,KAAKC,KAAKC,OACtBF,KAAKyC,EAAoB,IAAhBzC,KAAKC,KAAKC,MACnBF,KAAKuD,gBAAgB,MACZvD,KAAKyC,GAAsB,IAAhBzC,KAAKC,KAAKC,QAC9BF,KAAKyC,EAAqB,IAAhBzC,KAAKC,KAAKC,MACpBF,KAAKuD,gBAAgB,MAGnBvD,KAAK0C,GAAsB,IAAjB1C,KAAKC,KAAKE,QACtBH,KAAK0C,EAAqB,IAAjB1C,KAAKC,KAAKE,OACnBH,KAAKuD,gBAAgB,MACZvD,KAAK0C,GAAuB,IAAjB1C,KAAKC,KAAKE,SAC9BH,KAAK0C,EAAsB,IAAjB1C,KAAKC,KAAKE,OACpBH,KAAKuD,gBAAgB,UA1DrBnC,IA+DNpC,GAAS,GAAIe,aFiDF","file":"bundle.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})",null,"import './particles';\n\n// var particles = new Particles('.particles', {});\n","var canvas;\n\nfunction randomNorm(mean, stdev) {\n return Math.abs(Math.round((Math.random() * 2 - 1) + (Math.random() * 2 - 1) + (Math.random() * 2 - 1)) * stdev) + mean;\n}\n\nclass Canvas {\n constructor() {\n this.opts = {\n width : 4000,\n height : 2600,\n particleCount: 150,\n sizes : [ 3, 4, 6 ],\n colors : [ '#90c53f', '#47848f', '#920e04', '#50e3c2', '#F5A623', '#b8e986' ]\n }\n\n this.active = true;\n this.particles = []; // Initialize empty particles array\n\n this.canvas = document.querySelector('.particles');\n this.ctx = this.canvas.getContext(\"2d\");\n\n this.canvas.width = this.opts.width;\n this.canvas.height = this.opts.height;\n\n this.initializeParticles();\n this.drawParticles();\n\n requestAnimationFrame(this.animateParticles.bind(this));\n }\n\n initializeParticles() {\n for (var i = this.opts.particleCount - 1; i >= 0; i--) {\n var p = new Particle(this.ctx, this.opts);\n this.particles.push(p);\n }\n }\n\n drawParticles() {\n for (var i = this.opts.particleCount - 1; i >= 0; i--) {\n var p = this.particles[i];\n p.draw();\n }\n }\n\n updateParticles() {\n for (var i = this.particles.length - 1; i >= 0; i--) {\n var p = this.particles[i];\n p.move();\n p.boundaryCheck();\n }\n }\n\n clearCanvas() {\n this.ctx.clearRect(0, 0, this.opts.width, this.opts.height);\n }\n\n activate() {\n this.active = true;\n this.animateParticles();\n }\n\n deactivate() {\n this.active = false;\n }\n\n destroy() {\n var that = this;\n\n this.deactivate();\n setTimeout(function() {\n that.clearCanvas();\n }, 100);\n }\n\n animateParticles() {\n this.clearCanvas();\n this.drawParticles();\n this.updateParticles();\n\n if( this.active ) {\n requestAnimationFrame(this.animateParticles.bind(this));\n }\n }\n\n updateBoundaries() {\n for (var i=0; i<this.particles.length; i++) {\n this.particles[i].opts.width = this.opts.width;\n this.particles[i].opts.height = this.opts.height;\n }\n }\n};\n\n\nclass Particle {\n constructor(context, opts) {\n this.ctx = context\n this.opts = opts;\n\n var colorRand = Math.floor((Math.random() * opts.colors.length));\n var sizeRand = Math.floor((Math.random() * opts.sizes.length));\n\n this.color = opts.colors[colorRand];\n this.size = opts.sizes[sizeRand];\n\n console.log(this.color, this.size);\n\n this.x = Math.random() * this.opts.width\n this.y = Math.random() * this.opts.height\n\n this.vx = (2 * Math.random() + 4) * .01 * this.size;\n this.vy = (2 * Math.random() + 4) * .01 * this.size;\n\n this.direction = {\n x: -1 * Math.random() * 2,\n y: -1 * Math.random() * 2\n };\n }\n\n move() {\n this.x += this.vx * this.direction.x;\n this.y += this.vy * this.direction.y;\n }\n\n draw() {\n this.ctx.save();\n this.ctx.beginPath();\n this.ctx.translate(this.x, this.y);\n this.ctx.fillStyle = this.color;\n this.ctx.arc(0, 0, this.size, 0, 2 * Math.PI, false);\n this.ctx.fill();\n this.ctx.restore();\n }\n\n changeDirection(axis) {\n this.direction[axis] *= -1;\n }\n\n boundaryCheck() {\n if (this.x >= this.opts.width*1.2) {\n this.x = this.opts.width*1.2;\n this.changeDirection(\"x\");\n } else if (this.x <= -this.opts.width*0.2) {\n this.x = -this.opts.width*0.2;\n this.changeDirection(\"x\");\n }\n\n if (this.y >= this.opts.height*1.2) {\n this.y = this.opts.height*1.2;\n this.changeDirection(\"y\");\n } else if (this.y <= -this.opts.height*0.2) {\n this.y = -this.opts.height*0.2;\n this.changeDirection(\"y\");\n }\n }\n};\n\ncanvas = new Canvas();\n\n// window.onresize = evt => {\n// canvas.destroy();\n// canvas = new Canvas();\n// };\n"],"sourceRoot":"/source/"}