-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle.js.map
1 lines (1 loc) · 31.4 KB
/
bundle.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap 9034b3fca70257d80dc9","webpack:///./lib/run_script.js","webpack:///./lib/game.js","webpack:///./lib/canvas.js","webpack:///./lib/color.js","webpack:///./lib/environment.js","webpack:///./lib/listener.js","webpack:///./lib/layer.js","webpack:///./lib/wave.js","webpack:///./lib/wave_point.js","webpack:///./lib/util.js","webpack:///./lib/point.js","webpack:///./lib/ship.js","webpack:///./lib/snow.js","webpack:///./lib/snow_point.js","webpack:///./lib/star.js","webpack:///./lib/star_point.js","webpack:///./lib/rain.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA;;AAEA;;;;;;;ACFA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,iBAAgB,OAAO;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;;AAEA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;AC7CA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;;;;ACtBA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wBAAuB,OAAO,IAAI,OAAO,KAAK,OAAO;AACrD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wBAAuB,OAAO;AAC9B;AACA;;AAEA;AACA,wBAAuB,OAAO;AAC9B;AACA;;AAEA;AACA,wBAAuB,OAAO;AAC9B;AACA;;AAEA;AACA;AACA,wBAAuB,QAAQ;AAC/B;AACA;;AAEA;AACA,wBAAuB,OAAO;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAuB,mBAAmB;AAC1C;AACA;;AAEA;;;;;;;AC7DA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;;AAEA;;;;;;;ACjIA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;;;;ACnCA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iBAAgB,WAAW;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG;AACH;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG;AACH;AACA;AACA;AACA;AACA,MAAK;AACL,IAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC1FA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iBAAgB,wBAAwB;AACxC;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACzFA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,+BAA8B,0BAA0B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAAyC;AACzC;;;AAGA;;;;;;;ACxCA;AACA;AACA,4BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACXA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8BAA6B;;AAE7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,IAAG;AACH;AACA;;AAEA,iBAAgB,6BAA6B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA,wCAAuC;AACvC,wCAAuC;;AAEvC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;;AAKA;;;;;;;ACrFA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA,IAAG;AACH,mBAAkB,6BAA6B;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAAyC;AACzC,0CAAyC;;AAEzC;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;;;;;;AC1EA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,0CAAyC;AACzC;;;AAGA;;;;;;;ACzBA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA,iBAAgB,6BAA6B;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA,wCAAuC;AACvC,wCAAuC;;AAEvC;;AAEA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;;;;;;AC1FA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,kCAAiC;AACjC;;;AAGA;;;;;;;ACxBA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA","file":"bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 9034b3fca70257d80dc9\n **/","const Game = require('./game');\n\ndocument.addEventListener(\"DOMContentLoaded\", Game.init);\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/run_script.js\n ** module id = 0\n ** module chunks = 0\n **/","const Canvas = require('./canvas');\nconst Layer = require('./layer');\nconst Color = require('./color');\nconst Environment = require('./environment');\n\nconst Listener = require('./listener');\n\nfunction Game(){\n this.canvas = new Canvas;\n this.layers = [];\n this.tide = 3;\n\n this.oldTime = performance.now();\n\n for(let i = 0; i < 5; i++){\n const layer = new Layer(i, this.canvas);\n this.layers.push(layer);\n }\n}\n\nGame.init = function(){\n const game = new Game;\n game.run(performance.now());\n};\n\nGame.prototype.render = function(delta){\n this.canvas.render();\n this.layers.forEach( layer => {\n layer.render(delta);\n });\n};\n\nGame.prototype.run = function(time){\n\n const delta = (time - this.oldTime) / 16.6;\n this.oldTime = time;\n\n\n Color.step(delta);\n Environment.step(delta);\n\n this.render(delta);\n window.requestAnimationFrame(time => this.run(time));\n};\n\nmodule.exports = Game;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/game.js\n ** module id = 1\n ** module chunks = 0\n **/","const Color = require('./color');\n\nfunction Canvas(){\n this.self = document.getElementById(\"canvas\")\n\n this.self.width = window.innerWidth;\n this.self.height = window.innerHeight;\n\n this.width = this.self.width;\n this.height = this.self.height;\n this.ctx = this.self.getContext(\"2d\");\n\n\n this.ctx.globalAlpha = 0.7;\n}\n\nCanvas.prototype.render = function () {\n this.self.style.background = Color.main();\n this.ctx.clearRect(0, 0, this.width, this.height);\n};\n\n\nmodule.exports = Canvas;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/canvas.js\n ** module id = 2\n ** module chunks = 0\n **/","const Environment = require('./environment');\n\nfunction Color(){\n this.lIncreasing = true;\n\n this.h = Math.random() * 360;\n this.s = 100;\n this.l = 10;\n\n // change saturation based on rain???\n}\n\nColor.prototype.step = function(){\n this.h >= 360 ? this.h = 0 : this.h += .05;\n this.l = Math.abs(Environment.time - 50) * .5 + 5;\n};\n\nColor.prototype.main = function () {\n const hsla = `hsla(${this.h}, ${this.s}%, ${this.l}%, 1)`;\n return hsla;\n};\n\nColor.prototype.wave = function () {\n const rgba = `rgba(255, 255, 255, 0.3)`;\n return rgba;\n};\n\nColor.prototype.hull = function () {\n const hsla = `hsla(${this.h}, 15%, 2%, 1)`;\n return hsla;\n};\n\nColor.prototype.snow = function () {\n const hsla = `hsla(${this.h}, 50%, 85%, .9)`;\n return hsla;\n};\n\nColor.prototype.rain = function () {\n const hsla = `hsla(${this.h}, 40%, 75%, .7)`;\n return hsla;\n};\n\nColor.prototype.star = function () {\n const h = this.h + Math.floor(Math.random() * 3) * 30;\n const hsla = `hsla(${h + 180}, 75%, 85%, .5)`;\n return hsla;\n};\n\nColor.prototype.starGlow = function () {\n const hsla = `hsla(${this.h}, 0%, 100%, .05)`;\n return hsla;\n};\n\nColor.prototype.sail = function (dif) {\n // stands out too much on light bg as is\n // alter lightness/opacity based on base lightness??\n // return \"white\";\n const hsla = `hsla(${this.h + 135 + dif}, 50%, 80%, 1)`;\n return hsla;\n};\n\nmodule.exports = new Color;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/color.js\n ** module id = 3\n ** module chunks = 0\n **/","const Listener = require('./listener');\n\nfunction Environment(){\n this.time = Math.random() * 100;\n this.night = false;\n\n this.tide = 0;\n this.tideCap = 0;\n this.tideMax = 4;\n this.toggleTide();\n\n this.snowing = false;\n this.snowAmount = 0;\n this.snowCap = 100;\n\n this.raining = false;\n this.rainAmount = 0;\n this.rainCap = 100;\n\n // Math.random() < .5 ? this.toggleRain() : this.toggleSnow();\n this.toggleSnow();\n\n this.updraft = 0;\n this.breeze = 0;\n this.breezeCap = 10;\n this.toggleBreeze();\n}\n\nEnvironment.prototype.step = function (delta) {\n this.stepTime(delta);\n this.stepTide(delta);\n this.stepSnow(delta);\n this.stepWind(delta);\n this.stepRain(delta);\n};\n\nEnvironment.prototype.toggleSnow = function () {\n let timer;\n if(this.snowing){\n this.snowing = false;\n timer = Math.random() * 50000 + 10000;\n if(Math.random() > .8){\n setTimeout(() => this.toggleSnow(), timer);\n } else {\n setTimeout(() => this.toggleRain(), timer);\n }\n } else {\n this.snowing = true;\n this.snowCap = Math.floor(Math.random() * 5) * 50 + 50;\n timer = Math.random() * 20000 + 30000;\n setTimeout(() => this.toggleSnow(), timer);\n }\n};\n\nEnvironment.prototype.toggleRain = function () {\n let timer;\n if(this.raining){\n this.raining = false;\n timer = Math.random() * 50000 + 10000;\n if(Math.random() > .8){\n setTimeout(() => this.toggleRain(), timer);\n } else {\n setTimeout(() => this.toggleSnow(), timer);\n }\n } else {\n this.raining = true;\n this.rainCap = Math.floor(Math.random() * 5) * 50 + 50;\n timer = Math.random() * 20000 + 30000;\n setTimeout(() => this.toggleRain(), timer);\n }\n};\n\nEnvironment.prototype.stepSnow = function () {\n if(this.snowing && this.snowAmount < this.snowCap){\n this.snowAmount += .05;\n } else if(this.snowAmount > 0) {\n this.snowAmount -= .05;\n }\n};\n\nEnvironment.prototype.stepRain = function () {\n if(this.raining && this.rainAmount < this.rainCap){\n this.rainAmount += .05;\n } else if(this.rainAmount > 0) {\n this.rainAmount -= .05;\n }\n};\n\nEnvironment.prototype.stepTime = function () {\n this.time += .005;\n if(Math.floor(this.time) === 100) this.time = 0;\n if(Math.floor(this.time) === 30) this.night = true;\n if(Math.floor(this.time) === 70) this.night = false;\n};\n\nEnvironment.prototype.toggleBreeze = function () {\n const dir = Math.random() < .5 ? 1 : -1;\n this.breezeCap = Math.random() * 12 * dir;\n const timer = Math.random() * 10000 + 10000;\n setTimeout(() => this.toggleBreeze(), timer);\n};\n\nEnvironment.prototype.stepWind = function () {\n if(this.breeze > this.breezeCap){\n this.breeze -= 0.01;\n } else {\n this.breeze += 0.01;\n }\n};\n\nEnvironment.prototype.toggleTide = function () {\n const dir = Math.random() < .5 ? 1 : -1;\n const amount = Math.random() * 2;\n this.tideCap += dir * amount;\n if(this.tideCap > this.tideMax) this.tideCap = this.tideMax;\n if(this.tideCap < 0 - this.tideMax) this.tideCap = 0 - this.tideMax;\n\n const timer = Math.random() * 5000 + 2000;\n setTimeout(() => this.toggleTide(), timer);\n};\n\nEnvironment.prototype.stepTide = function (delta) {\n if(this.tide > this.tideCap){\n this.tide -= 0.01 * delta;\n } else {\n this.tide += 0.01;\n }\n};\n\nmodule.exports = new Environment;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/environment.js\n ** module id = 4\n ** module chunks = 0\n **/","const _viableKeys = [37, 38, 39, 40];\n\nfunction Listener(){\n this.keys = {};\n this.mouseX = 0;\n this.mouseY = 0;\n\n document.addEventListener(\"keydown\", e => this._keyDown(e));\n document.addEventListener(\"keyup\", e => this._keyUp(e));\n document.addEventListener(\"mousemove\", e => this._mouseMove(e));\n document.addEventListener(\"mouseenter\", e => this._mouseMove(e));\n}\n\nListener.prototype._keyDown = function (e) {\n const code = e.keyCode;\n if(_viableKeys.includes(code)){\n e.preventDefault();\n this.keys[e.keyCode] = true;\n }\n};\n\nListener.prototype._keyUp = function (e) {\n const code = e.keyCode;\n if(_viableKeys.includes(code)){\n e.preventDefault();\n delete this.keys[code];\n }\n};\n\nListener.prototype._mouseMove = function (e) {\n this.mouseX = (e.clientX - (window.innerWidth / 2)) / (window.innerWidth / 2);\n this.mouseY = (window.innerHeight - e.clientY) / (window.innerHeight);\n};\n\n\nmodule.exports = new Listener;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/listener.js\n ** module id = 5\n ** module chunks = 0\n **/","const Wave = require('./wave');\nconst Ship = require('./ship');\nconst Snow = require('./snow');\nconst Star = require('./star');\nconst Rain = require('./rain');\nconst Environment = require('./environment');\n\nfunction Layer(depth, canvas){\n this.depth = depth;\n this.ratio = .6 + depth/5;\n this.canvas = canvas;\n\n this.populate();\n}\n\nLayer.prototype.populate = function () {\n const wave = new Wave(this.canvas, this.depth, this.ratio);\n this.wave = wave;\n\n this.ships = [];\n const count = 1\n for(let i = 0; i < count; i++){\n const ship = new Ship(this.wave, this.canvas.ctx, this.ratio);\n this.ships.push(ship);\n }\n\n this.snow = [];\n this.rain = [];\n this.stars = [];\n};\n\nLayer.prototype.render = function (delta) {\n // if(Environment.night) this.addStars();\n if(Environment.snowAmount > 0) this.addSnow();\n if(Environment.rainAmount > 0) this.addRain();\n\n this.ships.forEach( ship => {\n ship.move(delta);\n ship.render();\n });\n this.snow.forEach( (flake, i, arr) => {\n flake.move(delta);\n // if(flake.point.y > window.innerHeight + 20){\n if(flake.radius < .05){\n arr[i] = null;\n } else flake.render();\n });\n this.stars.forEach( (star, i, arr) => {\n star.move();\n if(star.radius < .05){\n arr[i] = null;\n } else star.render();\n });\n this.rain.forEach( (drop, i, arr) => {\n drop.move();\n if(drop.y > window.innerHeight + 20){\n arr[i] = null;\n } else drop.render();\n });\n\n\n this.snow = this.snow.filter(Boolean);\n this.rain = this.rain.filter(Boolean);\n this.stars = this.stars.filter(Boolean);\n this.wave.move(delta);\n this.wave.render();\n};\n\nLayer.prototype.addSnow = function () {\n if(Math.floor(Math.random() * 500) < Environment.snowAmount){\n const flake = new Snow(this.wave, this.canvas.ctx, this.ratio);\n this.snow.push(flake);\n }\n};\n\nLayer.prototype.addRain = function () {\n console.log(this.rain.length);\n if(Math.floor(Math.random() * 50) < Environment.rainAmount){\n const drop = new Rain(this.canvas.ctx, this.ratio);\n this.rain.push(drop);\n }\n};\n\nLayer.prototype.addStars = function () {\n if(Math.floor(Math.random() * 1000) < 5){\n const star = new Star(this.wave, this.canvas.ctx, this.ratio);\n this.stars.push(star);\n }\n};\n\nmodule.exports = Layer;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/layer.js\n ** module id = 6\n ** module chunks = 0\n **/","const WavePoint = require('./wave_point');\nconst Color = require('./color');\nconst Environment = require('./environment');\n\nfunction Wave(canvas, depth, ratio) {\n this.canvas = canvas;\n this.ratio = ratio;\n this.spacing = 70 * this.ratio;\n this.y = canvas.height / 2 + depth * 50 * ratio;\n\n this.points = WavePoint.generatePoints(\n canvas.width,\n this.y,\n this.ratio,\n this.spacing\n );\n}\n\nWave.prototype.render = function() {\n const ctx = this.canvas.ctx;\n const width = this.canvas.width;\n const height = this.canvas.height;\n\n ctx.save();\n\n ctx.fillStyle = Color.wave();\n\n ctx.beginPath();\n ctx.moveTo(this.points[0].x, this.points[0].y);\n\n this.points.forEach( (point, i) => {\n const nextPoint = this.points[i + 1];\n if (nextPoint) {\n const ctrlPoint = {\n x: (point.x + nextPoint.x) / 2,\n y: (point.y + nextPoint.y) / 2\n };\n ctx.quadraticCurveTo(point.x, point.y, ctrlPoint.x, ctrlPoint.y);\n }\n });\n\n ctx.lineTo(width, height);\n ctx.lineTo(0, height);\n ctx.fill();\n\n ctx.restore();\n};\n\nWave.prototype.move = function (delta) {\n this.points.forEach( point => point.move(delta) );\n this.keepPointsInBounds();\n};\n\nWave.prototype.keepPointsInBounds = function(){\n const points = this.points;\n const spacing = this.spacing;\n\n if(points[points.length-1].x > this.canvas.width + spacing * 2){\n const newPoint = new WavePoint(\n points[0].x - spacing,\n points[0].x - spacing,\n points[points.length-1].y,\n points[points.length-1].oldY,\n points[0].ratio\n );\n points.unshift(newPoint);\n points.pop();\n\n } else if(points[0].x < (0 - spacing * 2)){\n const newPoint = new WavePoint(\n points[points.length-1].x + spacing,\n points[points.length-1].x + spacing,\n points[0].y,\n points[0].oldY,\n points[0].ratio\n );\n points.push(newPoint);\n points.shift();\n }\n};\n\nWave.prototype.getInfo = function(x){\n for(let i = 0; i < this.points.length; i++){\n if(x > this.points[i].x){\n return this.chunks[i].getInfo(x);\n }\n }\n};\n\nmodule.exports = Wave;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/wave.js\n ** module id = 7\n ** module chunks = 0\n **/","const Util = require('./util');\nconst Listener = require('./listener');\nconst Point = require('./point');\nconst Environment = require('./environment');\n\nfunction WavePoint(x, y, oldX, oldY, ratio){\n const angle = Math.random() * 360;\n const speed = 0.0075 + Math.random()*0.0275;\n const amplitude = (Math.random() * 10 + 30) * ratio;\n\n Point.call(this, x, y, oldX, oldY, ratio, angle, speed, amplitude)\n}\n\nUtil.inherits(WavePoint, Point);\n\nWavePoint.generatePoints = function(width, y, ratio, spacing){\n const points = [];\n\n for (let x = -(spacing * 2); x <= width + spacing * 2; x += spacing) {\n let randomOffset = Math.random() * 60 - 30;\n let xOffset = (Math.random()*20 - 10);\n const point = new WavePoint(\n x + xOffset * ratio,\n x + xOffset * ratio,\n y + (randomOffset + Math.random() * 20) * ratio,\n y + (randomOffset + Math.random() * 20) * ratio,\n ratio\n );\n points.push(point);\n }\n return points;\n};\n\nWavePoint.prototype.move = function (delta) {\n this.y = this.oldY + Math.sin(this.angle) * this.amplitude * this.ratio * .3 + Math.sin(this.angle) * this.amplitude * .5;\n this.x += Environment.tide * this.ratio * delta;\n this.angle += 1.5 * this.speed * delta; //* Math.abs(Listener.mouseX) + .5 * this.speed;\n};\n\n\nmodule.exports = WavePoint;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/wave_point.js\n ** module id = 8\n ** module chunks = 0\n **/","module.exports = {\n inherits (ChildClass, BaseClass) {\n function Surrogate () { this.constructor = ChildClass; }\n Surrogate.prototype = BaseClass.prototype;\n ChildClass.prototype = new Surrogate();\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/util.js\n ** module id = 9\n ** module chunks = 0\n **/","function Point(x, y, oldX, oldY, ratio, angle, speed, amplitude){\n this.x = x;\n this.y = y;\n this.oldX = oldX;\n this.oldY = oldY;\n this.ratio = ratio;\n this.angle = angle;\n this.speed = speed;\n this.amplitude = amplitude;\n}\n\nmodule.exports = Point;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/point.js\n ** module id = 10\n ** module chunks = 0\n **/","const Listener = require('./listener');\nconst Color = require('./color');\nconst Environment = require('./environment');\n\nfunction Ship(wave, ctx, ratio){\n this.wave = wave;\n this.ctx = ctx;\n this.x = Math.random() * (window.innerWidth - 100) + 50;\n this.y = 0;\n this.tilt = 0;\n this.ratio = ratio;\n this.colorDifference = (Math.floor(Math.random() * 5) - 2) * 15;\n}\n\nShip.prototype.render = function(){\n const ratio = this.ratio;\n this.ctx.fillStyle = Color.hull();\n\n this.ctx.save();\n\n // hull\n this.ctx.beginPath();\n const begin = .2 + this.tilt;\n const end = Math.PI-.2 + this.tilt;\n this.ctx.arc(this.x, this.y - 20 * ratio, 25 * ratio, begin, end);\n this.ctx.fill();\n\n // rotate for mast and sail\n this.ctx.translate(this.x, this.y);\n this.ctx.rotate(this.tilt); // rotate\n\n // mast\n // this.ctx.moveTo(0, -15);\n // this.ctx.lineTo(0, -60);\n // this.ctx.stroke();\n this.ctx.closePath();\n this.ctx.beginPath();\n\n // sail\n this.ctx.fillStyle = Color.sail(this.colorDifference);\n this.ctx.moveTo(0, -60 * ratio);\n this.ctx.lineTo(-30 * ratio - (this.tilt * 60 * ratio), -20 * ratio);\n this.ctx.lineTo(30 * ratio - (this.tilt * 60 * ratio), -20 * ratio);\n this.ctx.fill();\n\n this.ctx.restore();\n};\n\nShip.prototype.move = function(delta){\n this.x += .2 * Environment.breeze * delta;\n\n if(this.x < this.wave.points[0].x){\n this.x = window.innerWidth + 50;\n } else if(this.x > this.wave.points[this.wave.points.length - 1].x){\n this.x = -50;\n }\n\n for(let i = 0; i < this.wave.points.length; i++){\n const point = this.wave.points[i];\n if(point.x > this.x){\n const prevPoint = this.wave.points[i-1];\n\n const total = Math.abs(point.x - prevPoint.x)\n const left = Math.abs(this.x - prevPoint.x);\n const right = Math.abs(this.x - point.x);\n const leftWeight = right / total; // opposite on purpose\n const rightWeight = left / total; // closer should mean bigger, not smaller\n\n this.y = (prevPoint.y * leftWeight + point.y * rightWeight);\n const heightWidthRatio = (point.y - prevPoint.y) / (point.x - prevPoint.x);\n\n // maybe make use of the tide variable when determining x movement\n this.x += 6 * this.ratio * heightWidthRatio * (leftWeight < rightWeight ? leftWeight : rightWeight);\n this.tilt = (Math.PI / 2) * heightWidthRatio * (leftWeight < rightWeight ? leftWeight : rightWeight);\n\n break\n }\n }\n};\n\nmodule.exports = Ship;\n\n\n\n\n// y(t) = (y0−2y1+y2)t^2 + (2y1−2y0)t + y0\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/ship.js\n ** module id = 11\n ** module chunks = 0\n **/","const Color = require('./color');\nconst SnowPoint = require('./snow_point');\nconst Environment = require('./environment');\n\nfunction Snow(wave, ctx, ratio){\n this.wave = wave;\n this.ctx = ctx;\n this.ratio = ratio;\n this.displacement = Math.random() * 25 * ratio;\n\n this.point = new SnowPoint(this.ratio);\n this.falling = true;\n\n this.radius = 3 + Math.random() * 2;\n}\n\nSnow.prototype.move = function (delta) {\n if(this.point.oldX < 0){\n this.point.oldX = window.innerWidth;\n } else if(this.point.oldX > window.innerWidth){\n this.point.oldX = 0;\n }\n\n if(this.falling && this.point.y < this.wave.y){\n this.point.move(delta);\n } else {\n for(let i = 0; i < this.wave.points.length; i++){\n const point = this.wave.points[i];\n if(point.x > this.point.x){\n const prevPoint = this.wave.points[i-1];\n\n const total = Math.abs(point.x - prevPoint.x)\n const left = Math.abs(this.point.x - prevPoint.x);\n const right = Math.abs(this.point.x - point.x);\n const leftWeight = right / total; // opposite on purpose\n const rightWeight = left / total; // closer should mean bigger, not smaller\n\n const waveY = (prevPoint.y * leftWeight + point.y * rightWeight);\n\n if(this.falling && this.point.y < waveY - 2){\n this.point.move(delta);\n } else {\n this.falling = false;\n this.radius -= Environment.snowing ? 0.002 : 0.005;\n this.point.y = waveY;\n const heightWidthRatio = (point.y - prevPoint.y) / (point.x - prevPoint.x);\n\n // maybe make use of the tide variable when determining x movement\n this.point.x += 1 * this.ratio * heightWidthRatio * (leftWeight < rightWeight ? leftWeight : rightWeight);\n }\n break\n }\n }\n }\n};\n\n\nSnow.prototype.render = function () {\n const ratio = this.ratio;\n this.ctx.fillStyle = Color.snow();\n\n this.ctx.save();\n\n this.ctx.beginPath();\n const begin = .2 + this.tilt;\n const end = Math.PI-.2 + this.tilt;\n this.ctx.arc(this.point.x, this.point.y + this.displacement, this.radius * ratio, 0, Math.PI * 2);\n this.ctx.fill();\n this.ctx.closePath();\n\n this.ctx.restore();\n};\n\n\nmodule.exports = Snow;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/snow.js\n ** module id = 12\n ** module chunks = 0\n **/","const Util = require('./util');\nconst Point = require('./point');\nconst Environment = require('./environment');\n\nfunction SnowPoint(ratio){\n const x = Math.random() * window.innerWidth;\n const y = -20;\n const angle = Math.random() * 360;\n const speed = 0.0075 + Math.random()*0.0275;\n const amplitude = (Math.random() * 10 + 10) * ratio;\n\n Point.call(this, x, y, x, y, ratio, angle, speed, amplitude)\n}\n\nUtil.inherits(SnowPoint, Point);\n\nSnowPoint.prototype.move = function (delta) {\n this.y = this.oldY + Math.sin(this.angle) * this.amplitude * this.ratio;\n this.x = this.oldX + Math.sin(this.angle) * this.amplitude * this.ratio;\n this.oldX += Environment.breeze * this.ratio * delta;\n this.oldY += 1.5 * this.ratio - Environment.updraft * delta;\n this.angle += 1.5 * this.speed * delta; //* Math.abs(Listener.mouseX) + .5 * this.speed;\n};\n\n\nmodule.exports = SnowPoint;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/snow_point.js\n ** module id = 13\n ** module chunks = 0\n **/","const Color = require('./color');\nconst StarPoint = require('./star_point');\n\nfunction Star(wave, ctx, ratio){\n this.wave = wave;\n this.ctx = ctx;\n this.ratio = ratio;\n\n this.point = new StarPoint(this.ratio);\n this.falling = true;\n this.radius = 10;\n\n this.glowSize = 1;\n this.angle = Math.random() * 360;\n this.speed = 0.0075 + Math.random()*0.0275;\n}\n\nStar.prototype.move = function () {\n this.glowSize = 1 + Math.sin(this.angle);\n this.angle += this.speed;\n\n // conditionals need to be based on spacing\n if(this.point.x < this.wave.points[0].x){\n this.point.x = window.innerWidth + 10;\n } else if(this.point.x > this.wave.points[this.wave.points.length - 1].x){\n this.point.x = -10;\n }\n\n for(let i = 0; i < this.wave.points.length; i++){\n const point = this.wave.points[i];\n if(point.x > this.point.x){\n const prevPoint = this.wave.points[i-1];\n\n const total = Math.abs(point.x - prevPoint.x)\n const left = Math.abs(this.point.x - prevPoint.x);\n const right = Math.abs(this.point.x - point.x);\n const leftWeight = right / total; // opposite on purpose\n const rightWeight = left / total; // closer should mean bigger, not smaller\n\n const waveY = (prevPoint.y * leftWeight + point.y * rightWeight);\n\n if(this.falling && this.point.y < waveY - 2){\n this.point.move();\n } else {\n this.falling = false;\n this.radius -= 0.005;\n this.point.y = waveY;\n const heightWidthRatio = (point.y - prevPoint.y) / (point.x - prevPoint.x);\n\n // maybe make use of the tide variable when determining x movement\n this.point.x += 1 * this.ratio * heightWidthRatio * (leftWeight < rightWeight ? leftWeight : rightWeight);\n }\n break\n }\n }\n};\n\n\nStar.prototype.render = function () {\n const ratio = this.ratio;\n\n this.ctx.save();\n this.ctx.fillStyle = Color.star();\n\n this.ctx.beginPath();\n this.ctx.arc(this.point.x, this.point.y, this.radius * ratio * .7, 0, Math.PI * 2);\n this.ctx.fill();\n this.ctx.closePath();\n\n this.ctx.beginPath();\n this.ctx.arc(this.point.x, this.point.y, this.radius * ratio, 0, Math.PI * 2);\n this.ctx.fill();\n this.ctx.closePath();\n\n this.ctx.beginPath();\n this.ctx.arc(this.point.x, this.point.y, this.radius * ratio * 1.3, 0, Math.PI * 2);\n this.ctx.fill();\n this.ctx.closePath();\n\n this.ctx.fillStyle = Color.starGlow();\n\n this.ctx.beginPath();\n this.ctx.arc(this.point.x, this.point.y, this.radius * ratio * this.glowSize + 30 * ratio, 0, Math.PI * 2);\n this.ctx.fill();\n this.ctx.closePath();\n\n this.ctx.restore();\n};\n\n\nmodule.exports = Star;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/star.js\n ** module id = 14\n ** module chunks = 0\n **/","const Util = require('./util');\nconst Point = require('./point');\n\nfunction StarPoint(ratio){\n const x = Math.random() * window.innerWidth;\n const y = -20;\n const angle = Math.random() * 360;\n const speed = 0.0075 + Math.random()*0.0275;\n const amplitude = (Math.random() * 10 + 5) * ratio;\n\n Point.call(this, x, y, x, y, ratio, angle, speed, amplitude);\n}\n\nUtil.inherits(StarPoint, Point);\n\nStarPoint.prototype.move = function () {\n this.y = this.oldY + Math.sin(this.angle) * this.amplitude * this.ratio;\n this.x = this.oldX + Math.sin(this.angle) * this.amplitude * this.ratio;\n this.oldX += .5 * this.ratio;\n this.oldY += 4.5 * this.ratio;\n this.angle += 1.5 * this.speed; //* Math.abs(Listener.mouseX) + .5 * this.speed;\n};\n\n\nmodule.exports = StarPoint;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/star_point.js\n ** module id = 15\n ** module chunks = 0\n **/","const Color = require('./color');\nconst Environment = require('./environment');\n\nfunction Rain(ctx, ratio){\n this.ctx = ctx;\n this.ratio = ratio;\n this.x = Math.random() * window.innerWidth;\n this.y = -20;\n this.speed = 15;\n}\n\nRain.prototype.move = function () {\n if(this.x < 0){\n this.x = window.innerWidth;\n } else if(this.x > window.innerWidth){\n this.x = 0;\n }\n\n this.y += this.speed * this.ratio;\n this.x += .5 * Environment.breeze * this.ratio;\n};\n\n\nRain.prototype.render = function () {\n const ratio = this.ratio;\n this.ctx.strokeStyle = Color.rain();\n\n this.ctx.save();\n\n this.ctx.beginPath();\n this.ctx.moveTo(this.x, this.y);\n this.ctx.lineTo(this.x - Environment.breeze * ratio, this.y - 100 * ratio);\n this.ctx.stroke();\n this.ctx.closePath();\n\n this.ctx.restore();\n};\n\n\nmodule.exports = Rain;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./lib/rain.js\n ** module id = 16\n ** module chunks = 0\n **/"],"sourceRoot":""}