transport/main.min.js.map
2018-04-16 17:53:47 -04:00

1 line
34 KiB
Plaintext

{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/node.png","webpack:///./src/LineConnection.ts","webpack:///./src/utils.ts","webpack:///./src/Direction.ts","webpack:///./src/Station.ts","webpack:///./src/Line.ts","webpack:///./src/Train.ts","webpack:///./src/transport.ts"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","r","value","n","__esModule","default","object","property","p","jsonpArray","window","webpackJsonp","oldJsonpFunction","bind","slice","110","t","e","LineConnection","[object Object]","station","line","this","utils_randomInt","min","max","Math","floor","random","utils_weightedRandom","choices","weights","totalWeight","reduce","a","b","rand","cumulWeight","utils_randomPoint","lib","Point","innerWidth","innerHeight","utils_pointsAlmostEqual","pointA","pointB","abs","x","y","utils_distance","distX","distY","sqrt","utils_rangeMap","num","inMin","inMax","outMin","outMax","Direction_Direction","Direction","North","Northeast","East","Southeast","South","Southwest","West","Northwest","Direction_getPointDirection","angle","atan2","PI","utils_angleDegrees","direction","Error","Station_stationCount","Station_Station","stations","largest","population","point","radius","filter","location","prev","curr","closeStations","stationsWithinRadius","closeStationWeights","map","minDistance","tries","isPointDistant","color","connections","id","label","PIXI","Text","fill","fontFamily","fontSize","Line_CONNECTION_RADIUS","pow","Line_Line","currentStation","visitedStations","connectionLimit","otherStations","largestStation","indexOf","connectedStation","connectStations","trainCount","Train","speed","passengers","origin","destination","sprite","Sprite","loader","resources","nodeImg","texture","add","node","load","app","Application","antialias","height","width","viewport","dist_viewport","screenHeight","screenWidth","worldHeight","worldWidth","stats","stats_min","showPanel","document","body","appendChild","dom","ticker","Ticker","graphics","Graphics","numStations","randomDistantPoint","tinycolor","trains","numLines","lines","isDark","stationsWithoutConnections","centralHub","stationsLeft","numTrains","stationsWithConnections","originStation","stop","deltaTime","begin","train","conn","boardingPassengers","mix","round","disembarkingPassengers","journeyLeft","progress","clear","lineStyle","beginFill","parseInt","toHex","drawCircle","endFill","scale","tint","connection","twoWay","moveTo","lineTo","end","start","addChild","view","stage","drag","pinch","wheel","clampZoom","maxHeight","maxWidth","minHeight","minWidth","decelerate","addEventListener","renderer","resize"],"mappings":"aACA,SAAAA,EAAAC,GAOA,IANA,IAKAC,EAAAC,EALAC,EAAAH,EAAA,GACAI,EAAAJ,EAAA,GACAK,EAAAL,EAAA,GAGAM,EAAA,EAAAC,KACQD,EAAAH,EAAAK,OAAoBF,IAC5BJ,EAAAC,EAAAG,GACAG,EAAAP,IACAK,EAAAG,KAAAD,EAAAP,GAAA,IAEAO,EAAAP,GAAA,EAEA,IAAAD,KAAAG,EACAO,OAAAC,UAAAC,eAAAC,KAAAV,EAAAH,KACAc,EAAAd,GAAAG,EAAAH,IAIA,IADAe,KAAAhB,GACAO,EAAAC,QACAD,EAAAU,OAAAV,GAOA,OAHAW,EAAAR,KAAAS,MAAAD,EAAAb,OAGAe,IAEA,SAAAA,IAEA,IADA,IAAAC,EACAf,EAAA,EAAiBA,EAAAY,EAAAV,OAA4BF,IAAA,CAG7C,IAFA,IAAAgB,EAAAJ,EAAAZ,GACAiB,KACAC,EAAA,EAAkBA,EAAAF,EAAAd,OAA2BgB,IAAA,CAC7C,IAAAC,EAAAH,EAAAE,GACA,IAAAf,EAAAgB,KAAAF,MAEAA,IACAL,EAAAQ,OAAApB,IAAA,GACAe,EAAAM,IAAAC,EAAAN,EAAA,KAGA,OAAAD,EAIA,IAAAQ,KAGApB,GACAqB,EAAA,GAGAZ,KAGA,SAAAS,EAAA1B,GAGA,GAAA4B,EAAA5B,GACA,OAAA4B,EAAA5B,GAAA8B,QAGA,IAAAC,EAAAH,EAAA5B,IACAK,EAAAL,EACAgC,KACAF,YAUA,OANAhB,EAA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pBT,EAAMgD,QAERzC,EAAO0C,QAEPvD,EAASwD,SAASzC,GAElB,IAAK,MAAMkB,KAASb,EAClBpB,EAASwD,SAASvB,EAAM/C,QAG1B,IAAK,MAAM+C,KAASb,EAClBpB,EAASwD,SAASvB,EAAMtE,OAE1B,IAAK,MAAM7E,KAAW0D,EACpBwD,EAASwD,SAAS1K,EAAQ6E,OAE5B8C,SAASC,KAAKC,YAAYhB,EAAI8D,MAC9B9D,EAAI+D,MAAMF,SAASxD,GACnBA,EAAS2D,OAAOC,QAAQC,QAAQC,WAC9BC,UAzNoB,IA0NpBC,SA3NmB,IA4NnBC,UA7NoB,IA8NpBC,SA/NmB,MAgOlBC,aAEH/L,OAAOgM,iBAAiB,SAAU,KAChCzE,EAAI0E,SAASC,OAAOlM,OAAO+B,WAAY/B,OAAOgC","file":"main.min.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\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 \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\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.l = 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// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([110,0]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","module.exports = __webpack_public_path__ + \"726c2296b05703758a8f65fd9097f683.png\";","import Line from './Line';\nimport Station from './Station';\n\nexport default class LineConnection {\n public station: Station;\n public line: Line;\n\n constructor(\n station: Station,\n line: Line,\n ) {\n this.station = station;\n this.line = line;\n }\n}\n","import * as PIXI from 'pixi.js';\n\nconst EPSILON = 1.0;\n\nexport const randomInt = (min: number, max: number): number => (\n // inclusive of min and max\n Math.floor(Math.random() * (max - (min + 1))) + min\n);\n\nexport const weightedRandom = (choices: any[], weights: number[]): any => {\n const totalWeight = weights.reduce((a, b) => a + b, 0);\n const rand = randomInt(0, totalWeight);\n let cumulWeight = 0;\n for (let i = 0; i < weights.length; i += 1) {\n cumulWeight += weights[i];\n if (rand < cumulWeight) {\n return choices[i];\n }\n }\n};\n\nexport const randomPoint = () => (\n new PIXI.Point(randomInt(0, window.innerWidth), randomInt(0, window.innerHeight))\n);\n\nexport const pointsEqual = (pointA: PIXI.Point, pointB: PIXI.Point): boolean => (\n (pointA.x === pointB.x && pointA.y === pointB.y)\n);\n\nexport const pointsAlmostEqual = (pointA: PIXI.Point, pointB: PIXI.Point): boolean => (\n Math.abs(pointA.x - pointB.x) < EPSILON &&\n Math.abs(pointA.y - pointB.y) < EPSILON\n);\n\nexport const distance = (pointA: PIXI.Point, pointB: PIXI.Point): number => {\n const distX = pointA.x - pointB.x;\n const distY = pointA.y - pointB.y;\n return Math.sqrt((distX * distX) + (distY * distY));\n};\n\nexport const rangeMap = (num: number, inMin: number, inMax: number,\n outMin: number, outMax: number): number => (\n (num - inMin) * (outMax - outMin) / (inMax - inMin) + outMin\n);\n\nexport const angleRadians = (pointA: PIXI.Point, pointB: PIXI.Point): number => (\n Math.atan2(-(pointB.x - pointA.x), pointB.y - pointA.y)\n);\n\nexport const angleDegrees = (pointA: PIXI.Point, pointB: PIXI.Point): number => (\n 180 + angleRadians(pointA, pointB) * (180 / Math.PI)\n);\n","import * as PIXI from 'pixi.js';\n\nimport { angleDegrees } from './utils';\n\nenum Direction {\n North, // 0\n Northeast, // 1\n East, // 2\n Southeast, // 3\n South, // 4\n Southwest, // 5\n West, // 6\n Northwest, // 7\n}\n\nexport const getPointDirection = (pointA: PIXI.Point, pointB: PIXI.Point): Direction => {\n const angle = angleDegrees(pointA, pointB);\n let direction = null;\n if (angle >= 337.5 || angle < 22.5) {\n direction = Direction.North;\n } else if (angle >= 22.5 && angle < 67.5) {\n direction = Direction.Northeast;\n } else if (angle >= 67.5 && angle < 112.5) {\n direction = Direction.East;\n } else if (angle >= 112.5 && angle < 157.5) {\n direction = Direction.Southeast;\n } else if (angle >= 157.5 && angle < 202.5) {\n direction = Direction.South;\n } else if (angle >= 202.5 && angle < 247.5) {\n direction = Direction.Southwest;\n } else if (angle >= 247.5 && angle < 292.5) {\n direction = Direction.West;\n } else if (angle >= 292.5 && angle < 337.5) {\n direction = Direction.Northwest;\n } else {\n throw Error('Angle between points is not a valid degree');\n }\n return direction;\n};\n\nexport default Direction;\n","import * as tinycolor from 'tinycolor2';\n\nimport Direction, { getPointDirection } from './Direction';\nimport LineConnection from './LineConnection';\nimport { distance, randomPoint, weightedRandom } from './utils';\n\nlet stationCount = 0;\n\nexport default class Station {\n // Utility methods for working with arrays of Stations\n public static largestStation(stations: Station[]): Station {\n let largest: Station = null;\n for (const station of stations) {\n if (largest === null || station.population > largest.population) {\n largest = station;\n }\n }\n return largest;\n }\n\n public static stationsWithinRadius(stations: Station[], point: PIXI.Point,\n radius: number): Station[] {\n return stations.filter(station => distance(point, station.location) <= radius);\n }\n\n public static stationsInDirection(stations: Station[], point: PIXI.Point,\n direction: Direction): Station[] {\n return stations.filter(station => getPointDirection(point, station.location) === direction);\n }\n\n public static closestStation(stations: Station[], point: PIXI.Point): Station {\n return stations.reduce(\n (prev, curr) => distance(point, prev.location) < distance(point, curr.location) ? prev : curr,\n );\n }\n\n public static randomCloseLargeStation(stations: Station[], point: PIXI.Point,\n radius: number): Station {\n const closeStations = Station.stationsWithinRadius(stations, point,\n radius);\n const closeStationWeights = closeStations.map(station => station.population);\n return weightedRandom(closeStations, closeStationWeights);\n }\n\n public static isPointDistant(point: PIXI.Point, stations: Station[],\n minDistance: number): boolean {\n for (const station of stations) {\n if (distance(point, station.location) < minDistance) {\n return false;\n }\n }\n return true;\n }\n\n public static randomDistantPoint(stations: Station[], minDistance: number): PIXI.Point | null {\n let tries = 100;\n while (tries > 0) {\n const point = randomPoint();\n if (Station.isPointDistant(point, stations, minDistance)) {\n return point;\n }\n tries -= 1;\n }\n return null;\n }\n\n public location: PIXI.Point;\n public population: number;\n public connections: LineConnection[];\n public id: number;\n public label: PIXI.Text;\n public color: tinycolorInstance;\n\n constructor(\n location: PIXI.Point,\n population: number,\n color: tinycolorInstance,\n connections?: LineConnection[],\n ) {\n this.location = location;\n this.population = population;\n this.color = color;\n this.connections = connections || [];\n\n // for debugging\n stationCount += 1;\n this.id = stationCount;\n this.label = new PIXI.Text(`${this.id}`, {\n fill: '#FFA500',\n fontFamily: 'monospace',\n fontSize: '12px',\n });\n }\n}\n","import * as tinycolor from 'tinycolor2';\n\nimport Direction, { getPointDirection } from './Direction';\nimport LineConnection from './LineConnection';\nimport Station from './Station';\nimport { distance, randomInt, randomPoint } from './utils';\n\nconst CONNECTION_RADIUS = Math.floor(Math.sqrt(\n Math.pow(window.innerWidth, 2) + Math.pow(window.innerHeight, 2),\n) / 8);\n\nexport default class Line {\n public name: string;\n public color: tinycolorInstance;\n\n constructor(\n name: string,\n color: tinycolorInstance,\n ) {\n this.name = name;\n this.color = color;\n }\n\n public connectStations(\n currentStation: Station,\n stations: Station[],\n visitedStations: Station[],\n connectionLimit: number,\n ) {\n visitedStations.push(currentStation);\n const otherStations = stations.filter(station => station !== currentStation);\n const closeStations = Station.stationsWithinRadius(\n otherStations,\n currentStation.location,\n CONNECTION_RADIUS,\n );\n for (let i = 0; i < connectionLimit; i += 1) {\n if (closeStations.length < 1) {\n break;\n }\n const largest = Station.largestStation(closeStations);\n currentStation.connections.push(\n new LineConnection(largest, this),\n );\n closeStations.splice(closeStations.indexOf(largest), 1);\n }\n for (const connectedStation of currentStation.connections) {\n if (visitedStations.indexOf(connectedStation.station) === -1) {\n this.connectStations(\n connectedStation.station,\n stations,\n visitedStations,\n connectionLimit,\n );\n }\n }\n }\n}\n","import * as tinycolor from 'tinycolor2';\n\nimport Station from './Station';\n\nlet trainCount = 0;\n\nexport default class Train {\n public location: PIXI.Point;\n public speed: number;\n public origin: Station;\n public destination: Station;\n public passengers: number;\n public id: number;\n public label: PIXI.Text;\n public color: tinycolorInstance;\n public sprite: PIXI.Sprite;\n\n constructor(\n location: PIXI.Point,\n speed: number,\n passengers: number,\n origin: Station,\n destination: Station,\n color: tinycolorInstance,\n ) {\n this.location = location;\n this.speed = speed;\n this.origin = origin;\n this.destination = destination;\n this.passengers = passengers;\n this.color = color;\n\n this.sprite = new PIXI.Sprite(PIXI.loader.resources.nodeImg.texture);\n\n // for debugging\n trainCount += 1;\n this.id = trainCount;\n this.label = new PIXI.Text(`${this.id}`, {\n fill: '#AEAEAE',\n fontFamily: 'monospace',\n fontSize: '12px',\n });\n }\n\n public boardPassengers() {\n if (this.location === this.origin.location) { // about to leave a station\n }\n }\n}\n","import * as Viewport from 'pixi-viewport';\nimport * as PIXI from 'pixi.js';\nimport * as Stats from 'stats.js';\nimport * as tinycolor from 'tinycolor2';\n\nimport Direction from './Direction';\nimport Line from './Line';\nimport Station from './Station';\nimport Train from './Train';\nimport { distance, pointsAlmostEqual, pointsEqual, randomInt, randomPoint,\n rangeMap, weightedRandom } from './utils';\n\nimport * as imgNode from './node.png';\nimport './style.css';\n\nconst NODE_RES = 100;\n\nconst MAX_SPEED = 10.0;\nconst ACCELERATION = 0.025;\nconst APPROACH_DISTANCE = 3.0;\nconst TRAIN_CAPACITY = 50;\nconst LINE_CONNECTION_LIMIT = 5;\nconst WORLD_WIDTH = 1000;\nconst WORLD_HEIGHT = 1000;\nconst ZOOM_MIN_WIDTH = 100;\nconst ZOOM_MIN_HEIGHT = 100;\nconst ZOOM_MAX_WIDTH = 4000;\nconst ZOOM_MAX_HEIGHT = 4000;\n\nconst trainTexts: PIXI.Text[] = [];\n\nconst initStations = (numStations: number): Station[] => {\n const stations: Station[] = [];\n for (let i = 0; i < numStations; i += 1) {\n stations.push(new Station(\n Station.randomDistantPoint(stations, 30),\n randomInt(300, 2000),\n tinycolor.random()));\n }\n return stations;\n};\n\nconst initTrains = (numTrains: number, stations: Station[]): Train[] => {\n const trains = [];\n const stationsWithConnections = stations.filter(station => station.connections.length > 0);\n for (let i = 0; i < numTrains; i += 1) {\n const originStation = stationsWithConnections[\n Math.floor(Math.random() * stationsWithConnections.length)\n ];\n trains.push(new Train(\n new PIXI.Point(originStation.location.x, originStation.location.y),\n 0, 0, originStation, undefined, tinycolor('grey')),\n );\n }\n return trains;\n};\n\nconst initLines = (numLines: number, stations: Station[]): Line[] => {\n const lines = [];\n for (let i = 0; i < numLines; i += 1) {\n let color = tinycolor.random();\n while (color.isDark()) {\n color = tinycolor.random();\n }\n const stationsWithoutConnections = stations.filter(station =>\n station.connections.length === 0,\n );\n const centralHub = Station.largestStation(stationsWithoutConnections);\n const line = new Line(`line-${i}`, tinycolor.random());\n const stationsLeft = stations.slice(0);\n line.connectStations(centralHub, stationsLeft, [], LINE_CONNECTION_LIMIT);\n lines.push(line);\n }\n return lines;\n};\n\nconst moveTrains = (trains: Train[], stations: Station[]) => {\n for (const train of trains) {\n if (train.origin.connections.length === 0) {\n // train is stuck at an orphaned station\n continue;\n }\n // choose a destination randomly with a bias towards larger stations\n if (train.destination === undefined) {\n const otherStations = train.origin.connections.map(conn => conn.station);\n const closeStationWeights = otherStations.map(station => station.population);\n train.destination = weightedRandom(otherStations, closeStationWeights);\n\n // board passengers\n const boardingPassengers = randomInt(0, Math.min(TRAIN_CAPACITY - train.passengers,\n train.origin.population));\n // set or mix train color with the color of new passenger origin\n if (train.passengers === 0) {\n train.color = train.origin.color;\n } else {\n train.color = tinycolor.mix(\n train.color,\n train.origin.color,\n Math.round((boardingPassengers / train.passengers) * 100),\n );\n }\n train.passengers += boardingPassengers;\n train.origin.population -= boardingPassengers;\n }\n\n // train reached destination, stop moving and let passengers off\n if (pointsAlmostEqual(train.location, train.destination.location)) {\n train.speed = 0;\n\n // average destination color with passenger color weighted by ratio\n // (a simulation of culture mixing)\n train.destination.color = tinycolor.mix(\n train.destination.color,\n train.origin.color,\n Math.round((train.passengers / train.destination.population) * 100),\n );\n\n // transfer passengers to destination\n const disembarkingPassengers = randomInt(0, train.passengers);\n train.destination.population += disembarkingPassengers;\n train.passengers -= disembarkingPassengers;\n\n // prepare for next journey\n train.origin = train.destination;\n train.destination = undefined;\n continue;\n }\n\n const journeyLeft = distance(train.location, train.destination.location);\n\n if ((train.speed / ACCELERATION) >= ((journeyLeft / train.speed) - APPROACH_DISTANCE) &&\n train.speed !== ACCELERATION) {\n // slowing down\n train.speed -= ACCELERATION;\n } else if (train.speed < MAX_SPEED) {\n // speeding up\n train.speed += ACCELERATION;\n }\n\n // advance train\n const progress = train.speed / journeyLeft;\n train.location.x += ((train.destination.location.x - train.location.x) * progress);\n train.location.y += ((train.destination.location.y - train.location.y) * progress);\n }\n};\n\nconst drawStations = (stations: Station[], graphics: PIXI.Graphics) => {\n for (const station of stations) {\n const radius = station.population / 150;\n graphics.beginFill(parseInt(station.color.toHex(), 16), 0.5);\n graphics.drawCircle(station.location.x, station.location.y, radius);\n graphics.endFill();\n station.label.x = station.location.x + radius + 1;\n station.label.y = station.location.y + radius + 1;\n }\n};\n\nconst drawTrains = (trains: Train[], graphics: PIXI.Graphics) => {\n for (const train of trains) {\n const trainSize = rangeMap(train.passengers, 0, TRAIN_CAPACITY, 1, 5);\n const scale = trainSize / NODE_RES;\n train.sprite.x = train.location.x;\n train.sprite.y = train.location.y;\n train.sprite.scale.x = scale;\n train.sprite.scale.y = scale;\n train.sprite.tint = parseInt(train.color.toHex(), 16);\n train.label.x = train.location.x + scale + 1;\n train.label.y = train.location.y + scale + 1;\n }\n};\n\nconst drawLines = (stations: Station[], graphics: PIXI.Graphics) => {\n for (const station of stations) {\n for (const connection of station.connections) {\n let twoWay = false;\n for (const conn of connection.station.connections) {\n if (conn.station === station) {\n twoWay = true;\n }\n }\n graphics.lineStyle(twoWay ? 2 : 1, parseInt(connection.line.color.toHex(), 16), 1);\n graphics.moveTo(station.location.x, station.location.y);\n graphics.lineTo(connection.station.location.x, connection.station.location.y);\n }\n }\n};\n\nconst run = () => {\n const app = new PIXI.Application({\n antialias: true,\n height: window.innerHeight,\n width: window.innerWidth,\n });\n const viewport = new Viewport({\n screenHeight: window.innerHeight,\n screenWidth: window.innerWidth,\n worldHeight: WORLD_HEIGHT,\n worldWidth: WORLD_WIDTH,\n });\n const stats = new Stats();\n stats.showPanel(0);\n document.body.appendChild(stats.dom);\n const ticker = new PIXI.ticker.Ticker();\n const graphics = new PIXI.Graphics();\n\n const stations = initStations(30);\n const lines = initLines(4, stations);\n const trains = initTrains(50, stations);\n\n ticker.stop();\n ticker.add((deltaTime) => {\n stats.begin();\n\n moveTrains(trains, stations);\n\n graphics.clear();\n\n graphics.lineStyle(1, 0xFFA500, 1);\n drawStations(stations, graphics);\n\n graphics.lineStyle(1, 0xAEAEAE, 1);\n drawTrains(trains, graphics);\n\n drawLines(stations, graphics);\n\n stats.end();\n });\n ticker.start();\n\n viewport.addChild(graphics);\n // add train sprites\n for (const train of trains) {\n viewport.addChild(train.sprite);\n }\n // Add debug labels\n for (const train of trains) {\n viewport.addChild(train.label);\n }\n for (const station of stations) {\n viewport.addChild(station.label);\n }\n document.body.appendChild(app.view);\n app.stage.addChild(viewport);\n viewport.drag().pinch().wheel().clampZoom({\n maxHeight: ZOOM_MAX_HEIGHT,\n maxWidth: ZOOM_MAX_WIDTH,\n minHeight: ZOOM_MIN_HEIGHT,\n minWidth: ZOOM_MIN_WIDTH,\n }).decelerate();\n\n window.addEventListener('resize', () => {\n app.renderer.resize(window.innerWidth, window.innerHeight);\n });\n};\n\nPIXI.loader.add('nodeImg', imgNode).load(run);\n"],"sourceRoot":""}