diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f673a71 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5502 +} \ No newline at end of file diff --git a/3D_maze_Game/README.md b/3D_maze_Game/README.md new file mode 100644 index 0000000..2111f23 --- /dev/null +++ b/3D_maze_Game/README.md @@ -0,0 +1,9 @@ +### 3D-Maze-Game +. A 3D Maze Game made using ThreeJs and WebGL +. Explore the 3D experience +. You can move and operate the fpp by directional arrows. +. Player should reach the destination using map. + +![ss1](https://user-images.githubusercontent.com/64016811/119042625-b7ef0680-b9d5-11eb-896a-24f94212b896.jpg) + +![ss2](https://user-images.githubusercontent.com/64016811/119042632-b9b8ca00-b9d5-11eb-95a1-6b42d962dff2.jpg) \ No newline at end of file diff --git a/3D_maze_Game/assets/css/style.css b/3D_maze_Game/assets/css/style.css new file mode 100644 index 0000000..0609fb0 --- /dev/null +++ b/3D_maze_Game/assets/css/style.css @@ -0,0 +1,24 @@ +body { + margin: 0; +} + +#canvasContainer { + position: relative; +} + +/* JOYPAD */ +#joypad { + position: absolute; + bottom: 0; + right: 0; + width: 145px; +} + +#joypad .top { + text-align: center; + width: inherit; +} + +#joypad .bottom { + width: inherit; +} \ No newline at end of file diff --git a/3D_maze_Game/assets/images/html5-logo.png b/3D_maze_Game/assets/images/html5-logo.png new file mode 100644 index 0000000..b703d60 Binary files /dev/null and b/3D_maze_Game/assets/images/html5-logo.png differ diff --git a/3D_maze_Game/assets/images/pad/kbdown.png b/3D_maze_Game/assets/images/pad/kbdown.png new file mode 100644 index 0000000..8577c55 Binary files /dev/null and b/3D_maze_Game/assets/images/pad/kbdown.png differ diff --git a/3D_maze_Game/assets/images/pad/kbempty.png b/3D_maze_Game/assets/images/pad/kbempty.png new file mode 100644 index 0000000..cfa09bf Binary files /dev/null and b/3D_maze_Game/assets/images/pad/kbempty.png differ diff --git a/3D_maze_Game/assets/images/pad/kbleft.png b/3D_maze_Game/assets/images/pad/kbleft.png new file mode 100644 index 0000000..5d2d6d4 Binary files /dev/null and b/3D_maze_Game/assets/images/pad/kbleft.png differ diff --git a/3D_maze_Game/assets/images/pad/kbright.png b/3D_maze_Game/assets/images/pad/kbright.png new file mode 100644 index 0000000..134eafa Binary files /dev/null and b/3D_maze_Game/assets/images/pad/kbright.png differ diff --git a/3D_maze_Game/assets/images/pad/kbup.png b/3D_maze_Game/assets/images/pad/kbup.png new file mode 100644 index 0000000..4cfe098 Binary files /dev/null and b/3D_maze_Game/assets/images/pad/kbup.png differ diff --git a/3D_maze_Game/assets/images/preview-laby.png b/3D_maze_Game/assets/images/preview-laby.png new file mode 100644 index 0000000..44105f8 Binary files /dev/null and b/3D_maze_Game/assets/images/preview-laby.png differ diff --git a/3D_maze_Game/assets/images/textures/ground_diffuse.jpg b/3D_maze_Game/assets/images/textures/ground_diffuse.jpg new file mode 100644 index 0000000..3389399 Binary files /dev/null and b/3D_maze_Game/assets/images/textures/ground_diffuse.jpg differ diff --git a/3D_maze_Game/assets/images/textures/roof_diffuse.jpg b/3D_maze_Game/assets/images/textures/roof_diffuse.jpg new file mode 100644 index 0000000..d8d8d3d Binary files /dev/null and b/3D_maze_Game/assets/images/textures/roof_diffuse.jpg differ diff --git a/3D_maze_Game/assets/images/textures/wall_diffuse.jpg b/3D_maze_Game/assets/images/textures/wall_diffuse.jpg new file mode 100644 index 0000000..bac86e2 Binary files /dev/null and b/3D_maze_Game/assets/images/textures/wall_diffuse.jpg differ diff --git a/3D_maze_Game/assets/images/webgl-logo.png b/3D_maze_Game/assets/images/webgl-logo.png new file mode 100644 index 0000000..3b1a67f Binary files /dev/null and b/3D_maze_Game/assets/images/webgl-logo.png differ diff --git a/3D_maze_Game/assets/js/Demonixis.GameHelper.js b/3D_maze_Game/assets/js/Demonixis.GameHelper.js new file mode 100644 index 0000000..1b8f790 --- /dev/null +++ b/3D_maze_Game/assets/js/Demonixis.GameHelper.js @@ -0,0 +1,42 @@ +var Demonixis = window.Demonixis || {}; +Demonixis.GameHelper = Demonixis.GameHelper || {}; + +Demonixis.GameHelper.LevelHelper = function(start, end) { + this.current = start || 1; + this.next = this.current + 1; + this.count = end || 5; + this.isFinished = false; + + this.getNext = function() { + if (this.next > this.count) { + this.current = 1; + this.next = 2; + this.isFinished = true; + } else { + this.current = this.next; + this.next++; + } + + return this.current; + } +}; + +Demonixis.GameHelper.CameraHelper = function(camera) { + this.translation = 5; + this.rotation = 0.035; + this.origin = { + position: { + x: 0, + y: 0, + z: 0, + mapX: 0, + mapY: 0, + mapZ: 0 + }, + x: 0, + y: 0, + z: 0 + }; + + this.camera = camera; +}; \ No newline at end of file diff --git a/3D_maze_Game/assets/js/Demonixis.Input.js b/3D_maze_Game/assets/js/Demonixis.Input.js new file mode 100644 index 0000000..70779d8 --- /dev/null +++ b/3D_maze_Game/assets/js/Demonixis.Input.js @@ -0,0 +1,379 @@ +/** @namespace */ +var Demonixis = Demonixis || {}; + +Demonixis.Input = function() { + this.keys = { + up: false, + down: false, + left: false, + right: false, + space: false, + enter: false, + control: false, + alt: false, + shift: false, + num_0: false, + num_1: false, + num_2: false, + num_3: false, + num_4: false, + num_5: false, + num_6: false, + num_7: false, + num_8: false, + num_9: false, + a: false, + b: false, + c: false, + d: false, + e: false, + f: false, + g: false, + h: false, + i: false, + j: false, + k: false, + l: false, + m: false, + n: false, + o: false, + p: false, + q: false, + r: false, + s: false, + t: false, + u: false, + v: false, + w: false, + x: false, + y: false, + z: false, + k_0: false, + k_1: false, + k_2: false, + k_3: false, + k_4: false, + k_5: false, + k_6: false, + k_7: false, + k_8: false, + k_9: false + }; + + this.keyboardState = { + current: null, + last: null + }; + + this.joykeys = { + up: false, + down: false, + left: false, + right: false, + upLeft: false, + upRight: false, + downLeft: false, + downRight: false, + actionA: false, + actionB: false, + actionC: false, + actionX: false, + actionY: false, + actionZ: false, + triggerL: false, + triggerR: false, + start: false, + select: false + }; + + this.joykeyState = { + current: null, + last: null + }; + + var _this = this; + + // Clavier + this._onKeyboardDown = function(event) { + _this._onKeyStateChange(event, true); + }; + + this._onKeyboardUp = function(event) { + _this._onKeyStateChange(event, false); + }; + + document.addEventListener('keydown', this._onKeyboardDown, false); + document.addEventListener('keyup', this._onKeyboardUp, false); + + // Joystick virtuel + this.virtualJoyKeys = document.getElementsByClassName("joykey"); + + this._onJoykeyDown = function(event) { + _this._onJoykeyStateChange(event, true); + }; + + this._onJoykeyUp = function(event) { + _this._onJoykeyStateChange(event, false); + }; + + for (var i = 0, l = this.virtualJoyKeys.length; i < l; i++) { + this.virtualJoyKeys[i].addEventListener("mousedown", this._onJoykeyDown, false); + this.virtualJoyKeys[i].addEventListener("mouseup", this._onJoykeyUp, false); + this.virtualJoyKeys[i].addEventListener("touchstart", this._onJoykeyDown, false); + this.virtualJoyKeys[i].addEventListener("touchend", this._onJoykeyUp, false); + } +}; + +Demonixis.Input.prototype.destroy = function() { + document.removeEventListener('keydown', this._onKeyboardDown, false); + document.removeEventListener('keyup', this._onKeyboardUp, false); + + for (var i = 0, l = this.virtualJoyKeys.length; i < l; i++) { + this.virtualJoyKeys[i].removeEventListener("mousedown", this._onJoykeyDown, false); + this.virtualJoyKeys[i].removeEventListener("mouseup", this._onJoykeyUp, false); + this.virtualJoyKeys[i].removeEventListener("touchstart", this._onJoykeyDown, false); + this.virtualJoyKeys[i].removeEventListener("touchend", this._onJoykeyUp, false); + } +}; + +Demonixis.Input.prototype._onKeyStateChange = function(event, pressed) { + event.preventDefault(); + + switch (event.keyCode) { + case 13: + this.keys.enter = pressed; + break; // Entrer + case 16: + this.keys.shift = pressed; + break; // Shift + case 17: + this.keys.control = pressed; + break; // Control + case 18: + this.keys.alt = pressed; + break; // Alt + case 32: + this.keys.space = pressed; + break; // Espace + case 37: + this.keys.left = pressed; + break; // Gauche + case 38: + this.keys.up = pressed; + break; // Haut + case 39: + this.keys.right = pressed; + break; // Droite + case 40: + this.keys.down = pressed; + break; // Bas + case 48: + this.keys.k_0 = pressed; + break; // Touche 0 + case 49: + this.keys.k_1 = pressed; + break; // Touche 1 + case 50: + this.keys.k_2 = pressed; + break; // Touche 2 + case 51: + this.keys.k_3 = pressed; + break; // Touche 3 + case 52: + this.keys.k_4 = pressed; + break; // Touche 4 + case 53: + this.keys.k_5 = pressed; + break; // Touche 5 + case 54: + this.keys.k_6 = pressed; + break; // Touche 6 + case 55: + this.keys.k_7 = pressed; + break; // Touche 7 + case 56: + this.keys.k_8 = pressed; + break; // Touche 8 + case 57: + this.keys.k_9 = pressed; + break; // Touche 9 + case 65: + this.keys.a = pressed; + break; // Touche A + case 65: + this.keys.b = pressed; + break; // Touche B + case 65: + this.keys.c = pressed; + break; // Touche C + case 68: + this.keys.d = pressed; + break; // Touchd D + case 69: + this.keys.e = pressed; + break; // Touche E + case 70: + this.keys.f = pressed; + break; // Touche F + case 71: + this.keys.g = pressed; + break; // Touche F + case 72: + this.keys.h = pressed; + break; // Touche F + case 73: + this.keys.i = pressed; + break; // Touche F + case 74: + this.keys.j = pressed; + break; // Touche F + case 75: + this.keys.k = pressed; + break; // Touche F + case 76: + this.keys.l = pressed; + break; // Touche F + case 77: + this.keys.m = pressed; + break; // Touche F + case 78: + this.keys.n = pressed; + break; // Touche F + case 79: + this.keys.o = pressed; + break; // Touche F + case 80: + this.keys.p = pressed; + break; // Touche F + case 81: + this.keys.q = pressed; + break; // Touche Q + case 82: + this.keys.r = pressed; + break; // Touche R + case 83: + this.keys.s = pressed; + break; // Touche S + case 84: + this.keys.t = pressed; + break; // Touche T + case 85: + this.keys.u = pressed; + break; // Touche U + case 86: + this.keys.v = pressed; + break; // Touche V + case 87: + this.keys.w = pressed; + break; // Touche W + case 88: + this.keys.x = pressed; + break; // Touche X + case 89: + this.keys.y = pressed; + break; // Touche Y + case 90: + this.keys.z = pressed; + break; // Touche Z + case 96: + this.keys.num_0 = pressed; + break; // Pad 0 + case 97: + this.keys.num_1 = pressed; + break; // Pad 1 + case 98: + this.keys.num_2 = pressed; + break; // Pad 2 + case 99: + this.keys.num_3 = pressed; + break; // Pad 3 + case 100: + this.keys.num_4 = pressed; + break; // Pad 4 + case 101: + this.keys.num_5 = pressed; + break; // Pad 5 + case 102: + this.keys.num_6 = pressed; + break; // Pad 6 + case 103: + this.keys.num_7 = pressed; + break; // Pad 7 + case 104: + this.keys.num_8 = pressed; + break; // Pad 8 + case 105: + this.keys.num_9 = pressed; + break; // Pad 9 + } +}; + +Demonixis.Input.prototype._onJoykeyStateChange = function(event, pressed) { + event.preventDefault(); + var id = event.currentTarget.id; + + switch (id) { + case "keyup": + this.joykeys.up = pressed; + break; + case "keydown": + this.joykeys.down = pressed; + break; + case "keyleft": + this.joykeys.left = pressed; + break; + case "keyright": + this.joykeys.right = pressed; + break; + + case "keyUpLeft": + this.joykeys.upLeft = pressed; + break; + case "keyUpRight": + this.joykeys.upRight = pressed; + break; + case "keyDownLeft": + this.joykeys.downLeft = pressed; + break; + case "keyDownRight": + this.joykeys.downRight = pressed; + break; + + case "keyActionA": + this.joykeys.A = pressed; + break; + case "keyActionB": + this.joykeys.B = pressed; + break; + case "keyActionC": + this.joykeys.C = pressed; + break; + case "keyActionX": + this.joykeys.X = pressed; + break; + case "keyActionY": + this.joykeys.Y = pressed; + break; + case "keyActionZ": + this.joykeys.Z = pressed; + break; + + case "keyTriggerL": + this.joykeys.triggerL = pressed; + break; + case "keyTriggerR": + this.joykeys.triggerR = pressed; + break; + + case "keyButtonStart": + this.joykeys.start = pressed; + break; + case "keyButtonSelect": + this.joykeys.select = pressed; + break; + } +}; + +Demonixis.Input.prototype.pressed = function(key) { + return this.keys[key]; +}; \ No newline at end of file diff --git a/3D_maze_Game/assets/js/Demonixis.Minimap.js b/3D_maze_Game/assets/js/Demonixis.Minimap.js new file mode 100644 index 0000000..bdc6a1f --- /dev/null +++ b/3D_maze_Game/assets/js/Demonixis.Minimap.js @@ -0,0 +1,71 @@ +var Demonixis = window.Demonixis || {}; +Demonixis.Gui = Demonixis.Gui || {}; + +Demonixis.Gui.MiniMap = function(width, height, parent) { + this.parent = parent; + this.width = width; + this.height = height; + this.blockSize = { + width: 5, + height: 5 + }; + + this.playerPosition = { + x: 0, + y: 0 + }; + + this.miniMap = document.createElement("canvas"); + this.ctx = this.miniMap.getContext("2d"); + + this.create = function(top, left, position, border) { + var stylePosition = "position:absolute;"; + var styleTop = (top || "10") + "px;"; + var styleLeft = (left || "10") + "px;"; + var styleBorder = (border || "1px solid black") + ";"; + + this.miniMap.setAttribute("width", this.width * this.blockSize.width); + this.miniMap.setAttribute("height", this.height * this.blockSize.height); + this.miniMap.setAttribute("id", "miniMap"); + this.miniMap.setAttribute("style", stylePosition + "top:" + styleTop + "left:" + styleLeft + styleBorder); + + var domElement = document.getElementById(this.parent); + if (domElement[0] != "undefined") { + domElement.removeChild[domElement[0]]; + } + domElement.appendChild(this.miniMap); + }; + + this.draw = function(x, y, id) { + if (id == 1) { + this.ctx.fillStyle = "white"; + } else if (id == 'D') { + this.ctx.fillStyle = "red"; + this.playerPosition = { + x: x, + y: y + }; + } else if (id == 'J') { + this.ctx.fillStype = "yellow"; + } else if (id == 'A') { + this.ctx.fillStyle = "blue"; + } else { + this.ctx.fillStyle = "rgb(200, 200, 200)"; + } + + this.ctx.fillRect(x * 5, y * 5, 5, 5); + }; + + this.update = function(newPlayerPosition) { + this.ctx.fillStyle = "white"; + this.ctx.fillRect(this.playerPosition.x * this.blockSize.width, this.playerPosition.y * this.blockSize.height, this.blockSize.width, this.blockSize.height); + this.ctx.fillStyle = "red"; + this.ctx.fillRect(newPlayerPosition.x * this.blockSize.width, newPlayerPosition.y * this.blockSize.height, this.blockSize.width, this.blockSize.height); + this.playerPosition = newPlayerPosition; + }; + + this.drawAt = function(x, y, color) { + this.ctx.fillStyle = color; + this.ctx.fillRect(x * this.blockSize.width, y * this.blockSize.height, this.blockSize.width, this.blockSize.height); + }; +}; \ No newline at end of file diff --git a/3D_maze_Game/assets/js/maze3d.js b/3D_maze_Game/assets/js/maze3d.js new file mode 100644 index 0000000..c54d001 --- /dev/null +++ b/3D_maze_Game/assets/js/maze3d.js @@ -0,0 +1,319 @@ +(function() { + var width = window.innerWidth * 0.995; + var height = window.innerHeight * 0.995; + var canvasContainer = document.getElementById("canvasContainer"); + var renderer, camera, scene; + var input, miniMap, levelHelper, CameraHelper; + var map = new Array(); + var running = true; + + function initializeEngine() { + renderer = new THREE.WebGLRenderer({ + antialias: true + }); + + renderer.setSize(width, height); + renderer.clear(); + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x777777, 25, 1000); + + camera = new THREE.PerspectiveCamera(45, width / height, 1, 10000); + camera.position.y = 50; + + document.getElementById("canvasContainer").appendChild(renderer.domElement); + + input = new Demonixis.Input(); + levelHelper = new Demonixis.GameHelper.LevelHelper(); + cameraHelper = new Demonixis.GameHelper.CameraHelper(camera); + + window.addEventListener("resize", function() { + renderer.setSize(window.innerWidth, window.innerHeight); + }); + + var messageContainer = document.createElement("div"); + messageContainer.style.position = "absolute"; + messageContainer.style.backgroundColor = "#666"; + messageContainer.style.border = "1px solid #333"; + + var message = document.createElement("h1"); + message.innerHTML = "Use Up/Down/Left/Right arrows or the virtual pad to move and rotate the camera"; + message.style.textAlign = "center"; + message.style.color = "#ddd"; + message.style.padding = "15px"; + messageContainer.appendChild(message); + + document.body.appendChild(messageContainer); + + messageContainer.style.left = (window.innerWidth / 2 - messageContainer.offsetWidth / 2) + "px"; + messageContainer.style.top = (window.innerHeight / 2 - messageContainer.offsetHeight / 2) + "px"; + + var timer = setTimeout(function() { + clearTimeout(timer); + document.body.removeChild(messageContainer); + }, 3500); + } + + function initializeScene() { + miniMap = new Demonixis.Gui.MiniMap(map[0].length, map.length, "canvasContainer"); + miniMap.create(); + + var loader = new THREE.TextureLoader(); + var platformWidth = map[0].length * 100; + var platformHeight = map.length * 100; + + var floorGeometry = new THREE.BoxGeometry(platformWidth, 5, platformHeight); + var ground = new THREE.Mesh(floorGeometry, new THREE.MeshPhongMaterial({ + map: loader.load("assets/images/textures/ground_diffuse.jpg"), + })); + + repeatTexture(ground.material.map, 2); + + ground.position.set(-50, 1, -50); + scene.add(ground); + + var topMesh = new THREE.Mesh(floorGeometry, new THREE.MeshPhongMaterial({ + map: loader.load("assets/images/textures/roof_diffuse.jpg") + })); + + repeatTexture(topMesh.material.map, 16); + + topMesh.position.set(-50, 100, -50); + scene.add(topMesh); + + var size = { + x: 100, + y: 100, + z: 100 + }; + + var position = { + x: 0, + y: 0, + z: 0 + }; + + var wallGeometry = new THREE.BoxGeometry(size.x, size.y, size.z); + var wallMaterial = new THREE.MeshPhongMaterial({ + map: loader.load("assets/images/textures/wall_diffuse.jpg") + }); + + repeatTexture(wallMaterial.map, 2); + + // Map generation + for (var y = 0, ly = map.length; y < ly; y++) { + for (var x = 0, lx = map[x].length; x < lx; x++) { + position.x = -platformWidth / 2 + size.x * x; + position.y = 50; + position.z = -platformHeight / 2 + size.z * y; + + if (x == 0 && y == 0) { + cameraHelper.origin.x = position.x; + cameraHelper.origin.y = position.y; + cameraHelper.origin.z = position.z; + } + + if (map[y][x] > 1) { + var wall3D = new THREE.Mesh(wallGeometry, wallMaterial); + wall3D.position.set(position.x, position.y, position.z); + scene.add(wall3D); + } + + if (map[y][x] === "D") { + camera.position.set(position.x, position.y, position.z); + cameraHelper.origin.position.x = position.x; + cameraHelper.origin.position.y = position.y; + cameraHelper.origin.position.z = position.z; + cameraHelper.origin.position.mapX = x; + cameraHelper.origin.position.mapY = y; + cameraHelper.origin.position.mapZ = 0; + } + + miniMap.draw(x, y, map[y][x]); + } + } + + // Lights + var directionalLight = new THREE.HemisphereLight(0x192F3F, 0x28343A, 2); + directionalLight.position.set(1, 1, 0); + scene.add(directionalLight); + } + + function update() { + if (input.keys.up) { + moveCamera("up"); + } else if (input.keys.down) { + moveCamera("down"); + } + + if (input.keys.left) { + moveCamera("left"); + } else if (input.keys.right) { + moveCamera("right"); + } + + // Virtual pad + var params = { + rotation: 0.05, + translation: 5 + }; + + if (input.joykeys.up) { + moveCamera("up", params); + } else if (input.joykeys.down) { + moveCamera("down", params); + } + + if (input.joykeys.left) { + moveCamera("left", params); + } else if (input.joykeys.right) { + moveCamera("right", params); + } + } + + function draw() { + renderer.render(scene, camera); + } + + function moveCamera(direction, delta) { + var collides = false; + var position = { + x: camera.position.x, + z: camera.position.z + }; + var rotation = camera.rotation.y; + var offset = 50; + + var moveParamaters = { + translation: (typeof delta != "undefined") ? delta.translation : cameraHelper.translation, + rotation: (typeof delta != "undefined") ? delta.rotation : cameraHelper.rotation + }; + + switch (direction) { + case "up": + position.x -= Math.sin(-camera.rotation.y) * -moveParamaters.translation; + position.z -= Math.cos(-camera.rotation.y) * moveParamaters.translation; + break; + case "down": + position.x -= Math.sin(camera.rotation.y) * -moveParamaters.translation; + position.z += Math.cos(camera.rotation.y) * moveParamaters.translation; + break; + case "left": + rotation += moveParamaters.rotation; + break; + case "right": + rotation -= moveParamaters.rotation; + break; + } + + // Current position on the map + var tx = Math.abs(Math.floor(((cameraHelper.origin.x + (camera.position.x * -1)) / 100))); + var ty = Math.abs(Math.floor(((cameraHelper.origin.z + (camera.position.z * -1)) / 100))); + + // next position + var newTx = Math.abs(Math.floor(((cameraHelper.origin.x + (position.x * -1) + (offset)) / 100))); + var newTy = Math.abs(Math.floor(((cameraHelper.origin.z + (position.z * -1) + (offset)) / 100))); + + // Stay on the map + if (newTx >= map[0].length) { + newTx = map[0].length; + } + if (newTx < 0) { + newTx = 0; + } + if (newTy >= map.length) { + newTy = map.length; + } + if (newTy < 0) { + newTy = 0; + } + + if (map[newTy][newTx] != 1 && !isNaN(map[newTy][newTx])) { + collides = true; + } else if (map[newTy][newTx] == "A") { + // Game is over + running = false; + } + + if (collides == false) { + camera.rotation.y = rotation; + camera.position.x = position.x; + camera.position.z = position.z; + + miniMap.update({ + x: newTx, + y: newTy + }); + } else { + document.getElementById("bumpSound").play(); + } + } + + function mainLoop(time) { + if (running) { + update(); + draw(); + window.requestAnimationFrame(mainLoop, renderer.domElement); + } else { + endScreen(); + } + } + + function endScreen() { + if (levelHelper.isFinished || levelHelper.isMobile) { + alert("Good job, The game is over\n\nThanks you for playing!"); + document.location.href = "https://plus.google.com/u/0/114532615363095107351/posts"; + } else { + // Remove all childrens. + for (var i = 0, l = scene.children.length; i < l; i++) { + scene.remove(scene.children[i]); + } + renderer.clear(); + scene = new THREE.Scene(); + loadLevel(levelHelper.getNext()); + running = true; + } + } + + // Level loading + function loadLevel(level) { + var ajax = new XMLHttpRequest(); + ajax.open("GET", "assets/maps/maze3d-" + level + ".json", true); + ajax.onreadystatechange = function() { + if (ajax.readyState == 4) { + map = JSON.parse(ajax.responseText); + launch(); + } + } + ajax.send(null); + } + + function repeatTexture(texture, size) { + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.repeat.x = size; + texture.repeat.y = size; + return texture; + } + + // Game starting + function launch() { + initializeScene(); + mainLoop(); + } + + window.onload = function() { + initializeEngine(); + + var level = 1; // Get parameter + if (level > 0 || level <= levelHelper.count) { + levelHelper.current = level; + levelHelper.next = level + 1; + loadLevel(level); + } else { + levelHelper.current = 1; + levelHelper.next = 2; + loadLevel(1); + } + }; +})(); \ No newline at end of file diff --git a/3D_maze_Game/assets/js/three.min.js b/3D_maze_Game/assets/js/three.min.js new file mode 100644 index 0000000..47cb69e --- /dev/null +++ b/3D_maze_Game/assets/js/three.min.js @@ -0,0 +1,838 @@ +// threejs.org/license +(function(l,sa){"object"===typeof exports&&"undefined"!==typeof module?sa(exports):"function"===typeof define&&define.amd?define(["exports"],sa):sa(l.THREE=l.THREE||{})})(this,function(l){function sa(){}function B(a,b){this.x=a||0;this.y=b||0}function da(a,b,c,d,e,f,g,h,k,m){Object.defineProperty(this,"id",{value:ee++});this.uuid=T.generateUUID();this.sourceFile=this.name="";this.image=void 0!==a?a:da.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:da.DEFAULT_MAPPING;this.wrapS=void 0!==c? +c:1001;this.wrapT=void 0!==d?d:1001;this.magFilter=void 0!==e?e:1006;this.minFilter=void 0!==f?f:1008;this.anisotropy=void 0!==k?k:1;this.format=void 0!==g?g:1023;this.type=void 0!==h?h:1009;this.offset=new B(0,0);this.repeat=new B(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==m?m:3E3;this.version=0;this.onUpdate=null}function ga(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}function Db(a,b,c){this.uuid=T.generateUUID(); +this.width=a;this.height=b;this.scissor=new ga(0,0,a,b);this.scissorTest=!1;this.viewport=new ga(0,0,a,b);c=c||{};void 0===c.minFilter&&(c.minFilter=1006);this.texture=new da(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy,c.encoding);this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.depthTexture=void 0!==c.depthTexture?c.depthTexture:null}function Eb(a,b,c){Db.call(this,a,b,c);this.activeMipMapLevel= +this.activeCubeFace=0}function ba(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}function q(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}function J(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0= +d||0 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); +y.compileShader(P);y.compileShader(R);y.attachShader(N,P);y.attachShader(N,R);y.linkProgram(N);M=N;u=y.getAttribLocation(M,"position");v=y.getAttribLocation(M,"uv");c=y.getUniformLocation(M,"uvOffset");d=y.getUniformLocation(M,"uvScale");e=y.getUniformLocation(M,"rotation");f=y.getUniformLocation(M,"scale");g=y.getUniformLocation(M,"color");h=y.getUniformLocation(M,"map");k=y.getUniformLocation(M,"opacity");m=y.getUniformLocation(M,"modelViewMatrix");w=y.getUniformLocation(M,"projectionMatrix");n= +y.getUniformLocation(M,"fogType");p=y.getUniformLocation(M,"fogDensity");r=y.getUniformLocation(M,"fogNear");x=y.getUniformLocation(M,"fogFar");l=y.getUniformLocation(M,"fogColor");D=y.getUniformLocation(M,"alphaTest");N=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");N.width=8;N.height=8;P=N.getContext("2d");P.fillStyle="white";P.fillRect(0,0,8,8);ca=new da(N);ca.needsUpdate=!0}y.useProgram(M);E.initAttributes();E.enableAttribute(u);E.enableAttribute(v);E.disableUnusedAttributes(); +E.disable(y.CULL_FACE);E.enable(y.BLEND);y.bindBuffer(y.ARRAY_BUFFER,H);y.vertexAttribPointer(u,2,y.FLOAT,!1,16,0);y.vertexAttribPointer(v,2,y.FLOAT,!1,16,8);y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,F);y.uniformMatrix4fv(w,!1,Ka.projectionMatrix.elements);E.activeTexture(y.TEXTURE0);y.uniform1i(h,0);P=N=0;(R=q.fog)?(y.uniform3f(l,R.color.r,R.color.g,R.color.b),R&&R.isFog?(y.uniform1f(r,R.near),y.uniform1f(x,R.far),y.uniform1i(n,1),P=N=1):R&&R.isFogExp2&&(y.uniform1f(p,R.density),y.uniform1i(n,2),P=N=2)): +(y.uniform1i(n,0),P=N=0);for(var R=0,S=b.length;R/g,function(a,c){var d=X[c];if(void 0===d)throw Error("Can not resolve #include <"+c+">");return Cd(d)})}function ve(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);cb||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a} +function k(a){return T.isPowerOfTwo(a.width)&&T.isPowerOfTwo(a.height)}function m(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function w(b){b=b.target;b.removeEventListener("dispose",w);a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube);else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d["delete"](b)}q.textures--}function n(b){b=b.target;b.removeEventListener("dispose",n);var c=d.get(b),e=d.get(b.texture);if(b){void 0!== +e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b&&b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d["delete"](b.texture);d["delete"](b)}q.textures--}function p(b,g){var m=d.get(b);if(0x;x++)l[x]=p||n?n?b.image[x].image:b.image[x]:h(b.image[x],e.maxCubemapSize);var t=k(l[0]),u=f(b.format),ja=f(b.type);r(a.TEXTURE_CUBE_MAP, +b,t);for(x=0;6>x;x++)if(p)for(var B,C=l[x].mipmaps,z=0,N=C.length;zm;m++)e.__webglFramebuffer[m]=a.createFramebuffer()}else e.__webglFramebuffer=a.createFramebuffer();if(g){c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture);r(a.TEXTURE_CUBE_MAP,b.texture,h);for(m=0;6>m;m++)l(e.__webglFramebuffer[m],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+m);b.texture.generateMipmaps&&h&&a.generateMipmap(a.TEXTURE_CUBE_MAP);c.bindTexture(a.TEXTURE_CUBE_MAP, +null)}else c.bindTexture(a.TEXTURE_2D,f.__webglTexture),r(a.TEXTURE_2D,b.texture,h),l(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),b.texture.generateMipmaps&&h&&a.generateMipmap(a.TEXTURE_2D),c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){e=d.get(b);f=b&&b.isWebGLRenderTargetCube;if(b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");a.bindFramebuffer(a.FRAMEBUFFER, +e.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);p(b.depthTexture,0);e=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER, +a.DEPTH_ATTACHMENT,a.TEXTURE_2D,e,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0);else throw Error("Unknown depthTexture format");}else if(f)for(e.__webglDepthbuffer=[],f=0;6>f;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),t(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),t(e.__webglDepthbuffer, +b);a.bindFramebuffer(a.FRAMEBUFFER,null)}};this.updateRenderTargetMipmap=function(b){var e=b.texture;e.generateMipmaps&&k(b)&&1003!==e.minFilter&&1006!==e.minFilter&&(b=b&&b.isWebGLRenderTargetCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D,e=d.get(e).__webglTexture,c.bindTexture(b,e),a.generateMipmap(b),c.bindTexture(b,null))}}function xf(){var a={};return{get:function(b){b=b.uuid;var c=a[b];void 0===c&&(c={},a[b]=c);return c},"delete":function(b){delete a[b.uuid]},clear:function(){a={}}}}function yf(a,b,c){function d(b, +c,d){var e=new Uint8Array(4),f=a.createTexture();a.bindTexture(b,f);a.texParameteri(b,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(b,a.TEXTURE_MAG_FILTER,a.NEAREST);for(b=0;b=ia.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ia.maxTextures);da+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), +a=!0),b=b.texture);ua.setTexture2D(b,c)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0);ua.setTexture2D(b,c)}}();this.setTextureCube=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&& +6===b.image.length?ua.setTextureCube(b,c):ua.setTextureCubeDynamic(b,c)}}();this.getCurrentRenderTarget=function(){return V};this.setRenderTarget=function(a){(V=a)&&void 0===ea.get(a).__webglFramebuffer&&ua.setupRenderTarget(a);var b=a&&a.isWebGLRenderTargetCube,c;a?(c=ea.get(a),c=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,X.copy(a.scissor),fb=a.scissorTest,$a.copy(a.viewport)):(c=null,X.copy(ha).multiplyScalar(Qa),fb=la,$a.copy(fa).multiplyScalar(Qa));T!==c&&(A.bindFramebuffer(A.FRAMEBUFFER, +c),T=c);Y.scissor(X);Y.setScissorTest(fb);Y.viewport($a);b&&(b=ea.get(a.texture),A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,b.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===(a&&a.isWebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=ea.get(a).__webglFramebuffer;if(g){var h=!1;g!==T&&(A.bindFramebuffer(A.FRAMEBUFFER, +g),h=!0);try{var k=a.texture,m=k.format,n=k.type;1023!==m&&u(m)!==A.getParameter(A.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===n||u(n)===A.getParameter(A.IMPLEMENTATION_COLOR_READ_TYPE)||1015===n&&(ka.get("OES_texture_float")||ka.get("WEBGL_color_buffer_float"))||1016===n&&ka.get("EXT_color_buffer_half_float")?A.checkFramebufferStatus(A.FRAMEBUFFER)===A.FRAMEBUFFER_COMPLETE?0<=b&& +b<=a.width-d&&0<=c&&c<=a.height-e&&A.readPixels(b,c,d,e,u(m),u(n),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&A.bindFramebuffer(A.FRAMEBUFFER,T)}}}}}function Ib(a,b){this.name="";this.color=new O(a);this.density=void 0!==b?b:2.5E-4}function Jb(a,b,c){this.name="";this.color= +new O(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function jb(){z.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function Ed(a,b,c,d,e){z.call(this);this.lensFlares=[];this.positionScreen=new q;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)}function kb(a){U.call(this);this.type="SpriteMaterial";this.color=new O(16777215);this.map=null;this.rotation=0;this.lights=this.fog=!1;this.setValues(a)}function qc(a){z.call(this); +this.type="Sprite";this.material=void 0!==a?a:new kb}function rc(){z.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function lb(a,b,c,d,e,f,g,h,k,m,w,n){da.call(this,null,f,g,h,k,m,d,e,w,n);this.image={data:a,width:b,height:c};this.magFilter=void 0!==k?k:1003;this.minFilter=void 0!==m?m:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1}function bd(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new J;a=a||[];this.bones=a.slice(0); +this.useVertexTexture?(a=Math.sqrt(4*this.bones.length),a=T.nextPowerOfTwo(Math.ceil(a)),this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new lb(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,1023,1015)):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."), +this.boneInverses=[],b=0,a=this.bones.length;b=a.HAVE_CURRENT_DATA&&(w.needsUpdate=!0)}da.call(this,a,b,c,d,e,f,g,h,k);this.generateMipmaps=!1;var w=this;m()}function Lb(a,b,c,d,e,f,g,h,k,m,w,n){da.call(this,null,f,g,h,k,m,d,e,w,n);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1}function fd(a,b,c,d,e,f,g,h,k){da.call(this,a,b,c,d,e,f,g,h,k);this.needsUpdate=!0}function tc(a,b,c,d,e,f,g, +h,k,m){m=void 0!==m?m:1026;if(1026!==m&&1027!==m)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");da.call(this,null,d,e,f,g,h,m,c,k);this.image={width:a,height:b};this.type=void 0!==c?c:1012;this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Mb(a){function b(a,b){return a-b}G.call(this);var c=[0,0],d={},e=["a","b","c"];if(a&&a.isGeometry){var f=a.vertices,g=a.faces,h=0,k=new Uint32Array(6*g.length); +a=0;for(var m=g.length;an;n++){c[0]=w[e[n]];c[1]=w[e[(n+1)%3]];c.sort(b);var p=c.toString();void 0===d[p]&&(k[2*h]=c[0],k[2*h+1]=c[1],d[p]=!0,h++)}c=new Float32Array(6*h);a=0;for(m=h;an;n++)d=f[k[2*a+n]],h=6*a+3*n,c[h+0]=d.x,c[h+1]=d.y,c[h+2]=d.z;this.addAttribute("position",new C(c,3))}else if(a&&a.isBufferGeometry){if(null!==a.index){m=a.index.array;f=a.attributes.position;e=a.groups;h=0;0===e.length&&a.addGroup(0,m.length);k=new Uint32Array(2*m.length); +g=0;for(w=e.length;gn;n++)c[0]=m[a+n],c[1]=m[a+(n+1)%3],c.sort(b),p=c.toString(),void 0===d[p]&&(k[2*h]=c[0],k[2*h+1]=c[1],d[p]=!0,h++)}c=new Float32Array(6*h);a=0;for(m=h;an;n++)h=6*a+3*n,d=k[2*a+n],c[h+0]=f.getX(d),c[h+1]=f.getY(d),c[h+2]=f.getZ(d)}else for(f=a.attributes.position.array,h=f.length/3,k=h/3,c=new Float32Array(6*h),a=0,m=k;an;n++)h=18*a+6*n,k=9*a+3*n,c[h+0]=f[k],c[h+1]=f[k+1], +c[h+2]=f[k+2],d=9*a+(n+1)%3*3,c[h+3]=f[d],c[h+4]=f[d+1],c[h+5]=f[d+2];this.addAttribute("position",new C(c,3))}}function Nb(a,b,c){G.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f,g,h,k,m,w=b+1;for(f=0;f<=c;f++)for(m=f/c,g=0;g<=b;g++)k=g/b,h=a(k,m),d.push(h.x,h.y,h.z),e.push(k,m);a=[];var n;for(f=0;fd&&1===a.x&&(k[b]=a.x-1);0===c.x&&0===c.z&&(k[b]=d/2/Math.PI+.5)}G.call(this);this.type="PolyhedronBufferGeometry";this.parameters= +{vertices:a,indices:b,radius:c,detail:d};c=c||1;var h=[],k=[];(function(a){for(var c=new q,d=new q,g=new q,h=0;he&&(.2>b&&(k[a+0]+=1),.2>c&&(k[a+2]+=1),.2>d&&(k[a+4]+=1))})();this.addAttribute("position",ha(h,3));this.addAttribute("normal",ha(h.slice(),3));this.addAttribute("uv",ha(k,2));this.normalizeNormals();this.boundingSphere=new Ca(new q, +c)}function Ob(a,b){ua.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function vc(a,b){Q.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Ob(a,b));this.mergeVertices()}function Pb(a,b){ua.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters= +{radius:a,detail:b}}function wc(a,b){Q.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Pb(a,b));this.mergeVertices()}function Qb(a,b){var c=(1+Math.sqrt(5))/2;ua.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters= +{radius:a,detail:b}}function xc(a,b){Q.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Qb(a,b));this.mergeVertices()}function Rb(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;ua.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2, +6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function yc(a,b){Q.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Rb(a,b));this.mergeVertices()}function zc(a,b,c,d){Q.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d}; +this.fromBufferGeometry(new ua(a,b,c,d));this.mergeVertices()}function Sb(a,b,c,d,e){function f(e){var f=a.getPointAt(e/b),m=g.normals[e];e=g.binormals[e];for(n=0;n<=d;n++){var w=n/d*Math.PI*2,l=Math.sin(w),w=-Math.cos(w);k.x=w*m.x+l*e.x;k.y=w*m.y+l*e.y;k.z=w*m.z+l*e.z;k.normalize();r.push(k.x,k.y,k.z);h.x=f.x+c*k.x;h.y=f.y+c*k.y;h.z=f.z+c*k.z;p.push(h.x,h.y,h.z)}}G.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c|| +1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new q,k=new q,m=new B,w,n,p=[],r=[],l=[],t=[];for(w=0;wp;p++){e[0]=n[g[p]];e[1]=n[g[(p+1)%3]];e.sort(c);var l=e.toString();void 0===f[l]?f[l]={vert1:e[0],vert2:e[1],face1:m,face2:void 0}:f[l].face2=m}e=[];for(l in f)if(g=f[l],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=d)m=k[g.vert1],e.push(m.x),e.push(m.y),e.push(m.z),m=k[g.vert2],e.push(m.x),e.push(m.y),e.push(m.z);this.addAttribute("position",new C(new Float32Array(e),3))}function Ua(a, +b,c,d,e,f,g,h){function k(c){var e,f,k,n=new B,p=new q,l=0,w=!0===c?a:b,I=!0===c?1:-1;f=u;for(e=1;e<=d;e++)x.setXYZ(u,0,y*I,0),t.setXYZ(u,0,I,0),n.x=.5,n.y=.5,D.setXY(u,n.x,n.y),u++;k=u;for(e=0;e<=d;e++){var z=e/d*h+g,C=Math.cos(z),z=Math.sin(z);p.x=w*z;p.y=y*I;p.z=w*C;x.setXYZ(u,p.x,p.y,p.z);t.setXYZ(u,0,I,0);n.x=.5*C+.5;n.y=.5*z*I+.5;D.setXY(u,n.x,n.y);u++}for(e=0;ethis.duration&&this.resetDuration();this.optimize()}function ud(a){this.manager=void 0!==a?a:Ga;this.textures={}}function Id(a){this.manager=void 0!==a?a:Ga}function wb(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}}function Jd(a){"boolean"=== +typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:Ga;this.withCredentials=!1}function xe(a){this.manager=void 0!==a?a:Ga;this.texturePath=""}function ia(){}function Sa(a,b){this.v1=a;this.v2=b}function Oc(){this.curves=[];this.autoClose=!1}function Va(a,b,c,d,e,f,g,h){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g;this.aRotation=h||0}function xb(a){this.points= +void 0===a?[]:a}function yb(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d}function zb(a,b,c){this.v0=a;this.v1=b;this.v2=c}function Ab(){Pc.apply(this,arguments);this.holes=[]}function Pc(a){Oc.call(this);this.currentPoint=new B;a&&this.fromPoints(a)}function Kd(){this.subPaths=[];this.currentPath=null}function Ld(a){this.data=a}function ye(a){this.manager=void 0!==a?a:Ga}function Md(){void 0===Nd&&(Nd=new (window.AudioContext||window.webkitAudioContext));return Nd}function Od(a){this.manager= +void 0!==a?a:Ga}function ze(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new Ea;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new Ea;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function vd(a,b,c){z.call(this);this.type="CubeCamera";var d=new Ea(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new q(1,0,0));this.add(d);var e=new Ea(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new q(-1,0,0));this.add(e);var f=new Ea(90,1,a,b);f.up.set(0,0,1);f.lookAt(new q(0, +1,0));this.add(f);var g=new Ea(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new q(0,-1,0));this.add(g);var h=new Ea(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new q(0,0,1));this.add(h);var k=new Ea(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new q(0,0,-1));this.add(k);this.renderTarget=new Eb(c,c,{format:1022,magFilter:1006,minFilter:1006});this.updateCubeMap=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=this.renderTarget,p=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;c.activeCubeFace=0;a.render(b, +d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.texture.generateMipmaps=p;c.activeCubeFace=5;a.render(b,k,c);a.setRenderTarget(null)}}function Pd(){z.call(this);this.type="AudioListener";this.context=Md();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function dc(a){z.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource(); +this.source.onended=this.onEnded.bind(this);this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function Qd(a){dc.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function Rd(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount); +a.getOutput().connect(this.analyser)}function wd(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function fa(a,b,c){this.path=b;this.parsedPath=c||fa.parseTrackName(b);this.node=fa.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function Sd(a){this.uuid=T.generateUUID(); +this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var b={};this._indicesByUUID=b;for(var c=0,d=arguments.length;c!==d;++c)b[arguments[c].uuid]=c;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}function Td(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks; +b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled= +!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function Ud(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Ae(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function Bb(){G.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function Vd(a,b,c,d){this.uuid=T.generateUUID();this.data=a;this.itemSize=b;this.offset=c;this.normalized=!0=== +d}function ec(a,b){this.uuid=T.generateUUID();this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function fc(a,b,c){ec.call(this,a,b);this.meshPerAttribute=c||1}function gc(a,b,c){C.call(this,a,b);this.meshPerAttribute=c||1}function Wd(a,b,c,d){this.ray=new ab(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."); +return this.Points}}})}function Be(a,b){return a.distance-b.distance}function Xd(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new ha(b,3));b=new oa({fog:!1});this.cone=new la(a,b);this.add(this.cone);this.update()}function ic(a){this.bones=this.getBoneList(a);for(var b=new Q, +c=0;cd;d++)c.faces[d].color=this.colors[4>d?0:1];d=new Ma({vertexColors:1,wireframe:!0});this.lightSphere=new ya(c,d);this.add(this.lightSphere);this.update()}function Sc(a,b,c,d){b=b||1;c=new O(void 0!==c?c:4473924);d=new O(void 0!== +d?d:8947848);for(var e=b/2,f=2*a/b,g=[],h=[],k=0,m=0,l=-a;k<=b;k++,l+=f){g.push(-a,0,l,a,0,l);g.push(l,0,-a,l,0,a);var n=k===e?c:d;n.toArray(h,m);m+=3;n.toArray(h,m);m+=3;n.toArray(h,m);m+=3;n.toArray(h,m);m+=3}a=new G;a.addAttribute("position",new ha(g,3));a.addAttribute("color",new ha(h,3));g=new oa({vertexColors:2});la.call(this,a,g)}function Tc(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=0;(c=this.object.geometry)&&c.isGeometry?b=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."); +c=new G;b=new ha(6*b,3);c.addAttribute("position",b);la.call(this,c,new oa({color:a,linewidth:d}));this.matrixAutoUpdate=!1;this.update()}function lc(a,b){z.call(this);this.light=a;this.light.updateMatrixWorld();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;void 0===b&&(b=1);var c=new G;c.addAttribute("position",new ha([-b,b,0,b,b,0,b,-b,0,-b,-b,0,-b,b,0],3));var d=new oa({fog:!1});this.add(new Ta(c,d));c=new G;c.addAttribute("position",new ha([0,0,0,0,0,1],3));this.add(new Ta(c,d));this.update()} +function Uc(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new q);d.colors.push(new O(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new Q,e=new oa({color:16777215,vertexColors:1}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680); +b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);la.call(this,d,e);this.camera=a;this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix();this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update()}function Vc(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box= +new Ba;ya.call(this,new ob(1,1,1),new Ma({color:c,wireframe:!0}))}function Wc(a,b){void 0===b&&(b=16776960);var c=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),d=new Float32Array(24),e=new G;e.setIndex(new C(c,1));e.addAttribute("position",new C(d,3));la.call(this,e,new oa({color:b}));void 0!==a&&this.update(a)}function Cb(a,b,c,d,e,f){z.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);void 0===e&&(e=.2*c);void 0===f&&(f=.2*e);this.position.copy(b);this.line=new Ta(Ce,new oa({color:d})); +this.line.matrixAutoUpdate=!1;this.add(this.line);this.cone=new ya(De,new Ma({color:d}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c,e,f)}function xd(a){a=a||1;var b=new Float32Array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new G;a.addAttribute("position",new C(b,3));a.addAttribute("color",new C(c,3));b=new oa({vertexColors:2});la.call(this,a,b)}function Ee(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."); +$d.call(this,a);this.type="catmullrom";this.closed=!0}function yd(a,b,c,d,e,f){Va.call(this,a,b,c,c,d,e,f)}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52));void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0e;e++)8===e||13===e||18===e||23===e?b[e]="-":14===e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19===e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a, +b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead.");return Math.random()},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a* +T.DEG2RAD},radToDeg:function(a){return a*T.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nearestPowerOfTwo:function(a){return Math.pow(2,Math.round(Math.log(a)/Math.LN2))},nextPowerOfTwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}};B.prototype={constructor:B,isVector2:!0,get width(){return this.x},set width(a){this.x=a},get height(){return this.y},set height(a){this.y=a},set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x= +a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!== +b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), +this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a):this.y=this.x=0;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, +a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new B,b=new B);a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a,Math.min(b,c))/c)},floor:function(){this.x=Math.floor(this.x);this.y= +Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x* +this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.multiplyScalar(a/ +this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+ +1];return this},rotateAround:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=this.x-a.x,f=this.y-a.y;this.x=e*c-f*d+a.x;this.y=e*d+f*c+a.y;return this}};da.DEFAULT_IMAGE=void 0;da.DEFAULT_MAPPING=300;da.prototype={constructor:da,isTexture:!0,set needsUpdate(a){!0===a&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.image=a.image;this.mipmaps=a.mipmaps.slice(0);this.mapping=a.mapping;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter= +a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format;this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.generateMipmaps=a.generateMipmaps;this.premultiplyAlpha=a.premultiplyAlpha;this.flipY=a.flipY;this.unpackAlignment=a.unpackAlignment;this.encoding=a.encoding;return this},toJSON:function(a){if(void 0!==a.textures[this.uuid])return a.textures[this.uuid];var b={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping, +repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var c=this.image;void 0===c.uuid&&(c.uuid=T.generateUUID());if(void 0===a.images[c.uuid]){var d=a.images,e=c.uuid,f=c.uuid,g;void 0!==c.toDataURL?g=c:(g=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),g.width=c.width,g.height=c.height,g.getContext("2d").drawImage(c, +0,0,c.width,c.height));g=2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0> +a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y)}}};Object.assign(da.prototype,sa.prototype);var ee=0;ga.prototype={constructor:ga,isVector4:!0,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a; +return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, +this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this}, +addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){isFinite(a)? +(this.x*=a,this.y*=a,this.z*=a,this.w*=a):this.w=this.z=this.y=this.x=0;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y= +0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],k=a[9];c=a[2];b=a[6];var m=a[10];if(.01>Math.abs(d-g)&&.01>Math.abs(f-c)&&.01>Math.abs(k-b)){if(.1>Math.abs(d+g)&&.1>Math.abs(f+c)&&.1>Math.abs(k+b)&&.1>Math.abs(e+h+m-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;m=(m+1)/2;d=(d+g)/4;f=(f+c)/4;k=(k+b)/4;e>h&&e>m?.01>e?(b=0,d=c=.707106781):(b=Math.sqrt(e),c=d/b,d=f/b): +h>m?.01>h?(b=.707106781,c=0,d=.707106781):(c=Math.sqrt(h),b=d/c,d=k/c):.01>m?(c=b=.707106781,d=0):(d=Math.sqrt(m),b=f/d,c=k/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(f-c)*(f-c)+(g-d)*(g-d));.001>Math.abs(a)&&(a=1);this.x=(b-k)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x); +this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new ga,b=new ga);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y); +this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z); +this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}, +normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w= +a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w=a.array[b+3];return this}};Object.assign(Db.prototype,sa.prototype,{isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0, +0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Eb.prototype=Object.create(Db.prototype);Eb.prototype.constructor=Eb;Eb.prototype.isWebGLRenderTargetCube=!0;ba.prototype={constructor:ba,get x(){return this._x}, +set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get w(){return this._w},set w(a){this._w=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback(); +return this},setFromEuler:function(a,b){if(!1===(a&&a.isEuler))throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/2),g=Math.sin(a._y/2),h=Math.sin(a._z/2),k=a.order;"XYZ"===k?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"YXZ"===k?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"ZXY"===k?(this._x= +f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"ZYX"===k?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"YZX"===k?(this._x=f*d*e+c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e-f*g*h):"XZY"===k&&(this._x=f*d*e-c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e+f*g*h);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w= +Math.cos(c);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6],b=b[10],m=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+ +h)/c,this._y=(g+k)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a,b;return function(c,d){void 0===a&&(a=new q);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x* +a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), +this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,k=b._z,m=b._w;this._x=c*m+f*g+d*k-e*h;this._y=d*m+f*h+e*g-c*k;this._z=e*m+f*k+c*h-d*g;this._w=f*m-c*g-d*h-e*k;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z; +0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.sqrt(1-g*g);if(.001>Math.abs(h))return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;var k=Math.atan2(h,g),g=Math.sin((1-b)*k)/h,h=Math.sin(b*k)/h;this._w=f*g+this._w*h;this._x=c*g+this._x*h;this._y=d*g+this._y*h;this._z=e*g+this._z*h;this.onChangeCallback();return this},equals:function(a){return a._x=== +this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};Object.assign(ba,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a, +b,c,d,e,f,g){var h=c[d+0],k=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var l=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||k!==l||m!==n){f=1-g;var p=h*d+k*l+m*n+c*e,r=0<=p?1:-1,x=1-p*p;x>Number.EPSILON&&(x=Math.sqrt(x),p=Math.atan2(x,p*r),f=Math.sin(f*p)/x,g=Math.sin(g*p)/x);r*=g;h=h*f+d*r;k=k*f+l*r;m=m*f+n*r;c=c*f+e*r;f===1-g&&(g=1/Math.sqrt(h*h+k*k+m*m+c*c),h*=g,k*=g,m*=g,c*=g)}a[b]=h;a[b+1]=k;a[b+2]=m;a[b+3]=c}});q.prototype={constructor:q,isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this}, +setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, +this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+= +a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), +this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){isFinite(a)?(this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a;return function(b){!1===(b&&b.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new ba);return this.applyQuaternion(a.setFromEuler(b))}}(), +applyAxisAngle:function(){var a;return function(b,c){void 0===a&&(a=new ba);return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b= +this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,m=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-m*-f;this.y=k*a+b*-f+m*-e-h*-g;this.z=m*a+b*-g+h*-f-k*-e;return this},project:function(){var a;return function(b){void 0===a&&(a=new J); +a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyProjection(a)}}(),unproject:function(){var a;return function(b){void 0===a&&(a=new J);a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyProjection(a)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/= +a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(){var a,b;return function(c, +d){void 0===a&&(a=new q,b=new q);a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a,Math.min(b,c))/c)},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this}, +roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+ +Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a, +b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g;this.y=e*f-c*h;this.z=c*g-d*f;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a;return function(b){void 0===a&&(a=new q);a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a;return function(b){void 0=== +a&&(a=new q);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(T.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){var b=Math.sin(a.phi)*a.radius; +this.x=b*Math.sin(a.theta);this.y=Math.cos(a.phi)*a.radius;this.z=b*Math.cos(a.theta);return this},setFromMatrixPosition:function(a){return this.setFromMatrixColumn(a,3)},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){if("number"===typeof a){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index )."); +var c=a;a=b;b=c}return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];return this}};J.prototype={constructor:J,isMatrix4:!0, +set:function(a,b,c,d,e,f,g,h,k,m,l,n,p,r,x,t){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=k;q[6]=m;q[10]=l;q[14]=n;q[3]=p;q[7]=r;q[11]=x;q[15]=t;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new J).fromArray(this.elements)},copy:function(a){this.elements.set(a.elements);return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a, +b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a;return function(b){void 0===a&&(a=new q);var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,2).length();c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]* +f;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;return this}}(),makeRotationFromEuler:function(a){!1===(a&&a.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e,m=c*h,l=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+m*d;b[5]=a-l*d;b[9]=-c*g;b[2]=l-a*d;b[6]=m+k*d;b[10]=f*g}else"YXZ"=== +a.order?(a=g*h,k=g*e,m=d*h,l=d*e,b[0]=a+l*c,b[4]=m*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-m,b[6]=l+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,m=d*h,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=m+k*c,b[1]=k+m*c,b[5]=f*h,b[9]=l-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,m=c*h,l=c*e,b[0]=g*h,b[4]=m*d-k,b[8]=a*d+l,b[1]=g*e,b[5]=l*d+a,b[9]=k*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,m=c*g,l=c*d,b[0]=g*h,b[4]=l-a*e,b[8]=m*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k* +e+m,b[10]=a-l*e):"XZY"===a.order&&(a=f*g,k=f*d,m=c*g,l=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+l,b[5]=f*h,b[9]=k*e-m,b[2]=m*e-k,b[6]=c*h,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var m=c*h,c=c*k,l=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(l+e);b[4]=m-f;b[8]=c+h;b[1]=m+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]= +0;b[14]=0;b[15]=1;return this},lookAt:function(){var a,b,c;return function(d,e,f){void 0===a&&(a=new q,b=new q,c=new q);var g=this.elements;c.subVectors(d,e).normalize();0===c.lengthSq()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.lengthSq()&&(c.z+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), +this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],k=c[12],m=c[1],l=c[5],n=c[9],p=c[13],r=c[2],x=c[6],t=c[10],q=c[14],u=c[3],v=c[7],I=c[11],c=c[15],y=d[0],E=d[4],H=d[8],F=d[12],M=d[1],B=d[5],K=d[9],z=d[13],C=d[2],G=d[6],J=d[10],N=d[14],P=d[3],R=d[7],S=d[11],d=d[15];e[0]=f*y+g*M+h*C+k*P;e[4]=f*E+g*B+h*G+k*R;e[8]=f*H+g*K+h*J+k*S;e[12]= +f*F+g*z+h*N+k*d;e[1]=m*y+l*M+n*C+p*P;e[5]=m*E+l*B+n*G+p*R;e[9]=m*H+l*K+n*J+p*S;e[13]=m*F+l*z+n*N+p*d;e[2]=r*y+x*M+t*C+q*P;e[6]=r*E+x*B+t*G+q*R;e[10]=r*H+x*K+t*J+q*S;e[14]=r*F+x*z+t*N+q*d;e[3]=u*y+v*M+I*C+c*P;e[7]=u*E+v*B+I*G+c*R;e[11]=u*H+v*K+I*J+c*S;e[15]=u*F+v*z+I*N+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12]; +c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new q);void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;ethis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/h,m=1/k;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=m;b.elements[9]*=m;b.elements[10]*=m;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=k;return this}}(),makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c); +g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){a=c*Math.tan(T.DEG2RAD*a*.5);var e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),k=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*k;g[9]=0;g[13]=-((c+d)*k);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b= +this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}};Xa.prototype=Object.create(da.prototype); +Xa.prototype.constructor=Xa;Xa.prototype.isCubeTexture=!0;Object.defineProperty(Xa.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});var ie=new da,je=new Xa,fe=[],he=[];ne.prototype.setValue=function(a,b){for(var c=this.seq,d=0,e=c.length;d!==e;++d){var f=c[d];f.setValue(a,b[f.id])}};var zd=/([\w\d_]+)(\])?(\[|\.)?/g;Ya.prototype.setValue=function(a,b,c){b=this.map[b];void 0!==b&&b.setValue(a,c,this.renderer)};Ya.prototype.set=function(a,b,c){var d=this.map[c]; +void 0!==d&&d.setValue(a,b[c],this.renderer)};Ya.prototype.setOptional=function(a,b,c){b=b[c];void 0!==b&&this.setValue(a,c,b)};Ya.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsUpdate&&g.setValue(a,h.value,d)}};Ya.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!==e;++d){var f=a[d];f.id in b&&c.push(f)}return c};var La={merge:function(a){for(var b={},c=0;c 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n", +bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n", +clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n", +clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n", +color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n", +cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n", +defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n", +emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n", +envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n", +envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n", +envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n", +fog_fragment:"#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif", +lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n", +lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include \n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include \n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n", +lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n", +lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n", +lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n", +lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n", +logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n", +map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n", +metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n", +morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n", +normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n", +normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n", +packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n", +premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n", +roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n", +shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n", +shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n", +shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n", +skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n", +skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n", +specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n", +uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n", +uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif", +uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n", +cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n", +depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n", +equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n", +linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include \n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n", +meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n}\n", +normal_frag:"uniform float opacity;\nvarying vec3 vNormal;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include \n}\n",normal_vert:"varying vec3 vNormal;\n#include \n#include \n#include \n#include \nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"};O.prototype={constructor:O, +isColor:!0,r:1,g:1,b:1,set:function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setScalar:function(a){this.b=this.g=this.r=a;return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b, +c,d){b=T.euclideanModulo(b,1);c=T.clamp(c,0,1);d=T.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= +Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(c[1])/ +360,e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^\#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0=h?k/(e+f): +k/(2-e-f);switch(e){case b:g=(c-d)/k+(cthis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&& +this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new B).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){return(b||new B).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new B;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min); +this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};U.prototype={constructor:U,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(a){!0===a&&this.update();this._needsUpdate=a},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+ +b+"' parameter is undefined.");else{var d=this[b];void 0===d?console.warn("THREE."+this.type+": '"+b+"' is not a property of this material."):d&&d.isColor?d.set(c):d&&d.isVector3&&c&&c.isVector3?d.copy(c):this[b]="overdraw"===b?Number(c):c}}},toJSON:function(a){function b(a){var b=[],c;for(c in a){var d=a[c];delete d.metadata;b.push(d)}return b}var c=void 0===a;c&&(a={textures:{},images:{}});var d={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};d.uuid=this.uuid;d.type=this.type; +""!==this.name&&(d.name=this.name);this.color&&this.color.isColor&&(d.color=this.color.getHex());void 0!==this.roughness&&(d.roughness=this.roughness);void 0!==this.metalness&&(d.metalness=this.metalness);this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex());this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex());void 0!==this.shininess&&(d.shininess=this.shininess);this.map&&this.map.isTexture&&(d.map=this.map.toJSON(a).uuid);this.alphaMap&&this.alphaMap.isTexture&& +(d.alphaMap=this.alphaMap.toJSON(a).uuid);this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(a).uuid);this.bumpMap&&this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(a).uuid,d.bumpScale=this.bumpScale);this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(a).uuid,d.normalScale=this.normalScale.toArray());this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(a).uuid,d.displacementScale=this.displacementScale, +d.displacementBias=this.displacementBias);this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(a).uuid);this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(a).uuid);this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(a).uuid);this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(a).uuid);this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(a).uuid,d.reflectivity= +this.reflectivity);void 0!==this.size&&(d.size=this.size);void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation);1!==this.blending&&(d.blending=this.blending);2!==this.shading&&(d.shading=this.shading);0!==this.side&&(d.side=this.side);0!==this.vertexColors&&(d.vertexColors=this.vertexColors);1>this.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0e&&(e=m);l>f&&(f=l);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g)},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y|| +a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new q).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a;return function(b){void 0===a&&(a=new q);this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){var b,c;0=a.constant},clampPoint:function(a,b){return(b||new q).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new q;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new q;return function(b){b=b||new Ca;this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max); +this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new q,new q,new q,new q,new q,new q,new q,new q];return function(b){if(this.isEmpty())return this;a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x, +this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}};Ca.prototype={constructor:Ca,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a= +new Ba;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=0,f=0,g=b.length;f=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)- +this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(this.center.dot(a.normal)-a.constant)<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new q;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a= +a||new Ba;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}};Ia.prototype={constructor:Ia,isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,k){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=k;return this},identity:function(){this.set(1, +0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new q);void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;ec;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}};va.prototype={constructor:va,set:function(a,b){this.normal.copy(a); +this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new q,b=new q;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal); +this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var c=this.distanceToPoint(a);return(b|| +new q).copy(this.normal).multiplyScalar(c)},intersectLine:function(){var a=new q;return function(b,c){var d=c||new q,e=b.delta(a),f=this.normal.dot(e);if(0===f){if(0===this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],m=c[7],l=c[8],n=c[9],p=c[10],r=c[11],q=c[12],t=c[13],D=c[14],c=c[15]; +b[0].setComponents(f-a,m-g,r-l,c-q).normalize();b[1].setComponents(f+a,m+g,r+l,c+q).normalize();b[2].setComponents(f+d,m+h,r+n,c+t).normalize();b[3].setComponents(f-d,m-h,r-n,c-t).normalize();b[4].setComponents(f-e,m-k,r-p,c-D).normalize();b[5].setComponents(f+e,m+k,r+p,c+D).normalize();return this},intersectsObject:function(){var a=new Ca;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(), +intersectsSprite:function(){var a=new Ca;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var f=d[e];a.x=0g&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}};ab.prototype={constructor:ab,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.origin.copy(a.origin); +this.direction.copy(a.direction);return this},at:function(a,b){return(b||new q).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){this.direction.copy(a).sub(this.origin).normalize();return this},recast:function(){var a=new q;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new q;c.subVectors(a,this.origin);var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)}, +distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new q;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new q,b=new q,c=new q;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a); +var h=.5*d.distanceTo(e),k=-this.direction.dot(b),m=c.dot(this.direction),l=-c.dot(b),n=c.lengthSq(),p=Math.abs(1-k*k),r;0=-r?e<=r?(h=1/p,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+n):(e=h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):(e=-h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):e<=-r?(d=Math.max(0,-(-k*h+m)),e=0f)return null;f=Math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<= +a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z; +var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e;if(fg||e>d)return null;if(e>c||c!==c)c=e;if(gd?null:this.at(0<=c?c:d,b)},intersectsBox:function(){var a=new q;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a= +new q,b=new q,c=new q,d=new q;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a); +this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}};bb.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");bb.DefaultOrder="XYZ";bb.prototype={constructor:bb,isEuler:!0,get x(){return this._x},set x(a){this._x=a;this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a;this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a;this.onChangeCallback()},get order(){return this._order}, +set order(a){this._order=a;this.onChangeCallback()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback();return this},setFromRotationMatrix:function(a,b,c){var d=T.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],k=e[5],m=e[9],l=e[2],n=e[6],e=e[10];b=b|| +this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(n,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,k)):(this._y=Math.atan2(-l,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(-l,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(l,-1,1)),.99999> +Math.abs(l)?(this._x=Math.atan2(n,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-m,k),this._y=Math.atan2(-l,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(n,k),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback(); +return this},setFromQuaternion:function(){var a;return function(b,c,d){void 0===a&&(a=new J);a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a,c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ba;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1]; +this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new q(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}};Yc.prototype={constructor:Yc,set:function(a){this.mask=1<=b.x+b.y}}();wa.prototype={constructor:wa,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c); +return this},area:function(){var a=new q,b=new q;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new q).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return wa.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new va).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return wa.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return wa.containsPoint(a, +this.a,this.b,this.c)},closestPointToPoint:function(){var a,b,c,d;return function(e,f){void 0===a&&(a=new va,b=[new gb,new gb,new gb],c=new q,d=new q);var g=f||new q,h=Infinity;a.setFromCoplanarPoints(this.a,this.b,this.c);a.projectPoint(e,c);if(!0===this.containsPoint(c))g.copy(c);else{b[0].set(this.a,this.b);b[1].set(this.b,this.c);b[2].set(this.c,this.a);for(var k=0;kd;d++)if(e[d]===e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;cb.far?null:{distance:c,point:u.clone(),object:a}}function c(c,d,e,f,m,l,n,w){g.fromArray(f,3*l);h.fromArray(f,3*n);k.fromArray(f, +3*w);if(c=b(c,d,e,g,h,k,D))m&&(p.fromArray(m,2*l),r.fromArray(m,2*n),x.fromArray(m,2*w),c.uv=a(D,g,h,k,p,r,x)),c.face=new ea(l,n,w,wa.normal(g,h,k)),c.faceIndex=l;return c}var d=new J,e=new ab,f=new Ca,g=new q,h=new q,k=new q,m=new q,l=new q,n=new q,p=new B,r=new B,x=new B,t=new q,D=new q,u=new q;return function(q,t){var u=this.geometry,E=this.material,H=this.matrixWorld;if(void 0!==E&&(null===u.boundingSphere&&u.computeBoundingSphere(),f.copy(u.boundingSphere),f.applyMatrix4(H),!1!==q.ray.intersectsSphere(f)&& +(d.getInverse(H),e.copy(q.ray).applyMatrix4(d),null===u.boundingBox||!1!==e.intersectsBox(u.boundingBox)))){var F,M;if(u&&u.isBufferGeometry){var B,K,E=u.index,H=u.attributes,u=H.position.array;void 0!==H.uv&&(F=H.uv.array);if(null!==E)for(var H=E.array,z=0,C=H.length;zthis.scale.x*this.scale.y/4||c.push({distance:Math.sqrt(d),point:this.position, +face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)}});rc.prototype=Object.assign(Object.create(z.prototype),{constructor:rc,copy:function(a){z.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=d[e].distance)d[e- +1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(l.applyMatrix4(this.matrixWorld),t=d.ray.origin.distanceTo(l),td.far||e.push({distance:t,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else for(g=0,x=r.length/3-1;gf||(l.applyMatrix4(this.matrixWorld),t=d.ray.origin.distanceTo(l),td.far||e.push({distance:t,point:h.clone().applyMatrix4(this.matrixWorld), +index:g,face:null,faceIndex:null,object:this}))}else if(g&&g.isGeometry)for(k=g.vertices,m=k.length,g=0;gf||(l.applyMatrix4(this.matrixWorld),t=d.ray.origin.distanceTo(l),td.far||e.push({distance:t,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});la.prototype=Object.assign(Object.create(Ta.prototype), +{constructor:la,isLineSegments:!0});xa.prototype=Object.create(U.prototype);xa.prototype.constructor=xa;xa.prototype.isPointsMaterial=!0;xa.prototype.copy=function(a){U.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.size=a.size;this.sizeAttenuation=a.sizeAttenuation;return this};Kb.prototype=Object.assign(Object.create(z.prototype),{constructor:Kb,isPoints:!0,raycast:function(){var a=new J,b=new ab,c=new Ca;return function(d,e){function f(a,c){var f=b.distanceSqToPoint(a); +if(fd.far||e.push({distance:m,distanceToRay:Math.sqrt(f),point:h.clone(),index:c,face:null,object:g})}}var g=this,h=this.geometry,k=this.matrixWorld,m=d.params.Points.threshold;null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(k);if(!1!==d.ray.intersectsSphere(c)){a.getInverse(k);b.copy(d.ray).applyMatrix4(a);var m=m/((this.scale.x+this.scale.y+this.scale.z)/3), +l=m*m,m=new q;if(h&&h.isBufferGeometry){var n=h.index,h=h.attributes.position.array;if(null!==n)for(var p=n.array,n=0,r=p.length;nc)return null;var d=[],e=[],f=[],g,h,k;if(0=m--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}g=h;c<=g&&(g=0);h=g+1;c<=h&&(h=0);k=h+1;c<=k&&(k=0);var l;a:{var n, +p,r,q,t,D,u,v;n=a[e[g]].x;p=a[e[g]].y;r=a[e[h]].x;q=a[e[h]].y;t=a[e[k]].x;D=a[e[k]].y;if(0>=(r-n)*(D-p)-(q-p)*(t-n))l=!1;else{var I,y,E,H,F,M,B,z,C,G;I=t-r;y=D-q;E=n-t;H=p-D;F=r-n;M=q-p;for(l=0;l=-Number.EPSILON&&z>=-Number.EPSILON&&B>=-Number.EPSILON)){l=!1;break a}l=!0}}if(l){d.push([a[e[g]],a[e[h]],a[e[k]]]);f.push([e[g],e[h],e[k]]);g=h;for(k=h+1;kNumber.EPSILON){if(0q||q>p)return[];k=m*l-k*n;if(0>k||k>p)return[]}else{if(0c?[]:k===c?f?[]:[g]:a<=c?[g,h]:[g,m]}function f(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0e&&(e=d);var g=a+1;g>d&&(g=0);d=f(h[a],h[e],h[g],k[b]);if(!d)return!1;d=k.length-1;e=b-1;0>e&&(e=d);g=b+1;g>d&&(g=0);return(d=f(k[b],k[e],k[g],h[a]))?!0:!1}function d(a,b){var c,f;for(c=0;cN){console.log("Infinite Loop! Holes left:"+m.length+", Probably Hole outside Shape!");break}for(n=z;nk;k++)l=m[k].x+":"+m[k].y,l=n[l],void 0!==l&&(m[k]=l);return p.concat()},isClockWise:function(a){return 0>ra.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}}()};za.prototype=Object.create(Q.prototype);za.prototype.constructor= +za;za.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;dNumber.EPSILON){var k=Math.sqrt(h),m=Math.sqrt(d*d+g*g),h=b.x-f/k;b=b.y+e/k;g=((c.x-g/m-h)*g-(c.y+d/m-b)*d)/(e*g-f*d);d=h+e*g-a.x;e=b+f*g-a.y;f= +d*d+e*e;if(2>=f)return new B(d,e);f=Math.sqrt(f/2)}else a=!1,e>Number.EPSILON?d>Number.EPSILON&&(a=!0):e<-Number.EPSILON?d<-Number.EPSILON&&(a=!0):Math.sign(f)===Math.sign(g)&&(a=!0),a?(d=-f,f=Math.sqrt(h)):(d=e,e=f,f=Math.sqrt(h/2));return new B(d/f,e/f)}function e(a,b){var c,d;for(L=a.length;0<=--L;){c=L;d=L-1;0>d&&(d=a.length-1);var e,f=r+2*l;for(e=0;eMath.abs(b.y-c.y)?[new B(b.x,1-b.z),new B(c.x,1-c.z),new B(d.x,1-d.z),new B(e.x,1-e.z)]:[new B(b.y,1-b.z),new B(c.y,1-c.z),new B(d.y,1-d.z),new B(e.y, +1-e.z)]}};Dc.prototype=Object.create(za.prototype);Dc.prototype.constructor=Dc;mb.prototype=Object.create(G.prototype);mb.prototype.constructor=mb;Vb.prototype=Object.create(Q.prototype);Vb.prototype.constructor=Vb;Wb.prototype=Object.create(G.prototype);Wb.prototype.constructor=Wb;Ec.prototype=Object.create(Q.prototype);Ec.prototype.constructor=Ec;Fc.prototype=Object.create(Q.prototype);Fc.prototype.constructor=Fc;Xb.prototype=Object.create(G.prototype);Xb.prototype.constructor=Xb;Gc.prototype=Object.create(Q.prototype); +Gc.prototype.constructor=Gc;cb.prototype=Object.create(Q.prototype);cb.prototype.constructor=cb;cb.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),d=this.getValueSize(),this.times=ma.arraySlice(c,e,f),this.values=ma.arraySlice(this.values,e*d,f*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("invalid value size in track",this),a=!1);var c=this.times,b=this.values,d=c.length;0===d&&(console.error("track is empty", +this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("time is not a valid number",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("out of order keys",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ma.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("value is not a valid number",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1, +f=a.length-1,g=1;gk.opacity&&(k.transparent=!0);c.setTextures(h);return c.parse(k)}}()};wb.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;cg;g++)p=v[k++],u=D[2*p],p=D[2*p+1],u=new B(u,p),2!==g&&c.faceVertexUvs[d][h].push(u),0!==g&&c.faceVertexUvs[d][h+1].push(u);n&&(n=3*v[k++],r.normal.set(z[n++],z[n++],z[n]),t.normal.copy(r.normal));if(x)for(d=0;4>d;d++)n=3*v[k++],x=new q(z[n++],z[n++],z[n]),2!==d&&r.vertexNormals.push(x),0!==d&&t.vertexNormals.push(x);w&&(w=v[k++],w=y[w],r.color.setHex(w),t.color.setHex(w));if(b)for(d= +0;4>d;d++)w=v[k++],w=y[w],2!==d&&r.vertexColors.push(new O(w)),0!==d&&t.vertexColors.push(new O(w));c.faces.push(r);c.faces.push(t)}else{r=new ea;r.a=v[k++];r.b=v[k++];r.c=v[k++];h&&(h=v[k++],r.materialIndex=h);h=c.faces.length;if(d)for(d=0;dg;g++)p=v[k++],u=D[2*p],p=D[2*p+1],u=new B(u,p),c.faceVertexUvs[d][h].push(u);n&&(n=3*v[k++],r.normal.set(z[n++],z[n++],z[n]));if(x)for(d=0;3>d;d++)n=3*v[k++],x=new q(z[n++],z[n++],z[n]),r.vertexNormals.push(x); +w&&(w=v[k++],r.color.setHex(y[w]));if(b)for(d=0;3>d;d++)w=v[k++],r.vertexColors.push(new O(y[w]));c.faces.push(r)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;dk)g=d+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(T.clamp(d[k-1].dot(d[k]),-1,1)),e[k].applyMatrix4(h.makeRotationAxis(g,c))),f[k].crossVectors(d[k],e[k]);if(!0===b)for(c=Math.acos(T.clamp(e[0].dot(e[a]),-1,1)),c/=a,0=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null}, +getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;cc;)c+=b;for(;c>b;)c-=b;cb.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=Xc.interpolate;return new B(c(d.x,e.x,f.x,b.x,a),c(d.y,e.y,f.y,b.y,a))};yb.prototype=Object.create(ia.prototype); +yb.prototype.constructor=yb;yb.prototype.getPoint=function(a){var b=ra.b3;return new B(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y))};yb.prototype.getTangent=function(a){var b=Xc.tangentCubicBezier;return(new B(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y))).normalize()};zb.prototype=Object.create(ia.prototype);zb.prototype.constructor=zb;zb.prototype.getPoint=function(a){var b=ra.b2;return new B(b(a,this.v0.x, +this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y))};zb.prototype.getTangent=function(a){var b=Xc.tangentQuadraticBezier;return(new B(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y))).normalize()};var de=Object.assign(Object.create(Oc.prototype),{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;bNumber.EPSILON){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.yh.y))if(a.y=== +g.y){if(a.x===g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=ra.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);var g,h,k,l=[];if(1===f.length)return h=f[0],k=new Ab,k.curves=h.curves,l.push(k),l;var q=!e(f[0].getPoints()),q=a?!q:q;k=[];var n=[],p=[],r=0,x;n[r]=void 0;p[r]=[];for(var t=0,D=f.length;td&&this._mixBufferRegion(c,a,3*b,1-d,b);for(var d=b,f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d= +b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d,e){ba.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}};fa.prototype={constructor:fa,getValue:function(a,b){this.bind();this.getValue(a,b)},setValue:function(a,b){this.bind();this.setValue(a,b)},bind:function(){var a= +this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;a||(this.node=a=fa.findNode(this.rootNode,b.nodeName)||this.rootNode);this.getValue=this._getValue_unavailable;this.setValue=this._setValue_unavailable;if(a){if(c){var f=b.objectIndex;switch(c){case "materials":if(!a.material){console.error(" can not bind to material as node does not have a material",this);return}if(!a.material.materials){console.error(" can not bind to material.materials as node.material does not have a materials array", +this);return}a=a.material.materials;break;case "bones":if(!a.skeleton){console.error(" can not bind to bones as node does not have a skeleton",this);return}a=a.skeleton.bones;for(c=0;c=c){var n=c++,p=b[n];d[p.uuid]=q;b[q]=p;d[l]=n;b[n]=k;k=0;for(l=f;k!==l;++k){var p=e[k],r=p[q];p[q]=p[n];p[n]=r}}}this.nCachedObjects_=c},uncache:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._bindings,g=f.length,h=0,k=arguments.length;h!==k;++h){var l=arguments[h].uuid,q=e[l];if(void 0!== +q)if(delete e[l],qb||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0c.parameterPositions[1]&& +(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){var b=this.timeScale,c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0],b=b*d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a;if(0===a)return b;var c=this._clip.duration,d=this.loop,e=this._loopCount;if(2200===d)a:{if(-1===e&&(this.loopCount= +0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{d=2202===d;-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(b>=c||0>b){var f=Math.floor(b/c),b=b-c*f,e=e+Math.abs(f),g=this.repetitions-e;0>g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,b=0a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:f}))}if(d&&1===(e&1))return this.time=b,c-b}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time, +f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}};Object.assign(Ud.prototype,sa.prototype,{clipAction:function(a,b){var c=b||this._root,d=c.uuid,e="string"===typeof a?Ha.findByName(c,a):a,c=null!==e?e.uuid:a,f=this._actionsByClip[c],g=null;if(void 0!==f){g=f.actionByRoot[d];if(void 0!==g)return g;g=f.knownActions[0];null===e&&(e=g._clip)}if(null===e)return null;e=new Td(this, +e,b);this._bindAction(e,g);this._addInactiveAction(e,c,d);return e},existingAction:function(a,b){var c=b||this._root,d=c.uuid,c="string"===typeof a?Ha.findByName(c,a):a,c=this._actionsByClip[c?c.uuid:a];return void 0!==c?c.actionByRoot[d]||null:null},stopAllAction:function(){for(var a=this._actions,b=this._nActiveActions,c=this._bindings,d=this._nActiveBindings,e=this._nActiveBindings=this._nActiveActions=0;e!==b;++e)a[e].reset();for(e=0;e!==d;++e)c[e].useCount=0;return this},update:function(a){a*= +this.timeScale;for(var b=this._actions,c=this._nActiveActions,d=this.time+=a,e=Math.sign(a),f=this._accuIndex^=1,g=0;g!==c;++g){var h=b[g];h.enabled&&h._update(d,a,e,f)}a=this._bindings;b=this._nActiveBindings;for(g=0;g!==b;++g)a[g].apply(f);return this},getRoot:function(){return this._root},uncacheClip:function(a){var b=this._actions;a=a.uuid;var c=this._actionsByClip,d=c[a];if(void 0!==d){for(var d=d.knownActions,e=0,f=d.length;e!==f;++e){var g=d[e];this._deactivateAction(g);var h=g._cacheIndex, +k=b[b.length-1];g._cacheIndex=null;g._byClipCacheIndex=null;k._cacheIndex=h;b[h]=k;b.pop();this._removeInactiveBindingsForAction(g)}delete c[a]}},uncacheRoot:function(a){a=a.uuid;var b=this._actionsByClip,c;for(c in b){var d=b[c].actionByRoot[a];void 0!==d&&(this._deactivateAction(d),this._removeInactiveAction(d))}c=this._bindingsByRootAndName[a];if(void 0!==c)for(var e in c)a=c[e],a.restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,b){var c=this.existingAction(a,b); +null!==c&&(this._deactivateAction(c),this._removeInactiveAction(c))}});Object.assign(Ud.prototype,{_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings,g=a._interpolants,h=c.uuid,k=this._bindingsByRootAndName,l=k[h];void 0===l&&(l={},k[h]=l);for(k=0;k!==e;++k){var q=d[k],n=q.name,p=l[n];if(void 0===p){p=f[k];if(void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,h,n));continue}p=new wd(fa.create(c,n,b&&b._propertyBindings[k].binding.parsedPath), +q.ValueTypeName,q.getValueSize());++p.referenceCount;this._addInactiveBinding(p,h,n)}f[k]=p;g[k].resultBuffer=p.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}}, +_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length}, +get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex;return null!==a&&ah.end&&(h.end=f);c||(c=k)}}for(k in d)h=d[k],this.createAnimation(k,h.start,h.end,a);this.firstAnimation=c};na.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};na.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};na.prototype.setAnimationFPS=function(a,b){var c= +this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)};na.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};na.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};na.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};na.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};na.prototype.getAnimationDuration= +function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};na.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("THREE.MorphBlendMesh: animation["+a+"] undefined in .playAnimation()")};na.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};na.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b +d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.start+T.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);d.currentFrame!== +d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=e*g,this.morphTargetInfluences[d.lastFrame]=(1-e)*g):this.morphTargetInfluences[d.currentFrame]=g}}};Qc.prototype=Object.create(z.prototype);Qc.prototype.constructor=Qc;Qc.prototype.isImmediateRenderObject=!0;Rc.prototype=Object.create(la.prototype);Rc.prototype.constructor=Rc;Rc.prototype.update=function(){var a=new q,b=new q,c=new Ia;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld); +var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,k=g.faces,l=g=0,q=k.length;lc.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();Cb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix(); +this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};Cb.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};xd.prototype=Object.create(la.prototype);xd.prototype.constructor=xd;var $d=function(){function a(){}var b=new q,c=new a,d=new a,e=new a;a.prototype.init=function(a,b,c,d){this.c0=a;this.c1=c;this.c2=-3*a+3*b-2*c-d;this.c3=2*a-2*b+c+d};a.prototype.initNonuniformCatmullRom=function(a,b,c,d,e,l,n){this.init(b,c,((b-a)/e-(c-a)/ +(e+l)+(c-b)/l)*l,((c-b)/l-(d-b)/(l+n)+(d-c)/n)*l)};a.prototype.initCatmullRom=function(a,b,c,d,e){this.init(b,c,e*(c-a),e*(d-b))};a.prototype.calc=function(a){var b=a*a;return this.c0+this.c1*a+this.c2*b+this.c3*b*a};return ia.create(function(a){this.points=a||[];this.closed=!1},function(a){var g=this.points,h,k;k=g.length;2>k&&console.log("duh, you need at least 2 points");a*=k-(this.closed?0:1);h=Math.floor(a);a-=h;this.closed?h+=0h&&(h=1);1E-4>k&&(k=h);1E-4>p&&(p=h);c.initNonuniformCatmullRom(l.x,w.x,n.x,g.x,k, +h,p);d.initNonuniformCatmullRom(l.y,w.y,n.y,g.y,k,h,p);e.initNonuniformCatmullRom(l.z,w.z,n.z,g.z,k,h,p)}else"catmullrom"===this.type&&(k=void 0!==this.tension?this.tension:.5,c.initCatmullRom(l.x,w.x,n.x,g.x,k),d.initCatmullRom(l.y,w.y,n.y,g.y,k),e.initCatmullRom(l.z,w.z,n.z,g.z,k));return new q(c.calc(a),d.calc(a),e.calc(a))})}();Ee.prototype=Object.create($d.prototype);var Ef=ia.create(function(a){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3");this.points= +void 0===a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=Xc.interpolate;return new q(c(d.x,e.x,f.x,b.x,a),c(d.y,e.y,f.y,b.y,a),c(d.z,e.z,f.z,b.z,a))}),Ff=ia.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b=ra.b3;return new q(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y),b(a,this.v0.z,this.v1.z,this.v2.z, +this.v3.z))}),Gf=ia.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b=ra.b2;return new q(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y),b(a,this.v0.z,this.v1.z,this.v2.z))}),Hf=ia.create(function(a,b){this.v1=a;this.v2=b},function(a){if(1===a)return this.v2.clone();var b=new q;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b});yd.prototype=Object.create(Va.prototype);yd.prototype.constructor=yd;Object.assign(mc.prototype,{center:function(a){console.warn("THREE.Box2: .center() has been renamed to .getCenter()."); +return this.getCenter(a)},empty:function(){console.warn("THREE.Box2: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},size:function(a){console.warn("THREE.Box2: .size() has been renamed to .getSize().");return this.getSize(a)}});Object.assign(Ba.prototype,{center:function(a){console.warn("THREE.Box3: .center() has been renamed to .getCenter()."); +return this.getCenter(a)},empty:function(){console.warn("THREE.Box3: .empty() has been renamed to .isEmpty().");return this.isEmpty()},isIntersectionBox:function(a){console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},isIntersectionSphere:function(a){console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)},size:function(a){console.warn("THREE.Box3: .size() has been renamed to .getSize()."); +return this.getSize(a)}});Object.assign(gb.prototype,{center:function(a){console.warn("THREE.Line3: .center() has been renamed to .getCenter().");return this.getCenter(a)}});Object.assign(Ia.prototype,{multiplyVector3:function(a){console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."); +return this.applyToVector3Array(a)}});Object.assign(J.prototype,{extractPosition:function(a){console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");return this.copyPosition(a)},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(a)},multiplyVector3:function(a){console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."); +return a.applyProjection(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."); +a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},translate:function(a){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(a){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(a){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(a){console.error("THREE.Matrix4: .rotateZ() has been removed.")}, +rotateByAxis:function(a,b){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}});Object.assign(va.prototype,{isIntersectionLine:function(a){console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().");return this.intersectsLine(a)}});Object.assign(ba.prototype,{multiplyVector3:function(a){console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)}});Object.assign(ab.prototype, +{isIntersectionBox:function(a){console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().");return this.intersectsBox(a)},isIntersectionPlane:function(a){console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().");return this.intersectsPlane(a)},isIntersectionSphere:function(a){console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().");return this.intersectsSphere(a)}});Object.assign(Ab.prototype,{extrude:function(a){console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."); +return new za(this,a)},makeGeometry:function(a){console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.");return new cb(this,a)}});Object.assign(q.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}, +getPositionFromMatrix:function(a){console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(b, +a)}});Object.assign(z.prototype,{getChildByName:function(a){console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a)},renderDepth:function(a){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(a,b){console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)}});Object.defineProperties(z.prototype, +{eulerOrder:{get:function(){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");return this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order.");this.rotation.order=a}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(a){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}); +Object.defineProperties(rc.prototype,{objects:{get:function(){console.warn("THREE.LOD: .objects has been renamed to .levels.");return this.levels}}});Ea.prototype.setLens=function(a,b){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.");void 0!==b&&(this.filmGauge=b);this.setFocalLength(a)};Object.defineProperties(pa.prototype,{onlyShadow:{set:function(a){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."); +this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left.");this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right.");this.shadow.camera.right=a}},shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top.");this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."); +this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near.");this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far.");this.shadow.camera.far=a}},shadowCameraVisible:{set:function(a){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias."); +this.shadow.bias=a}},shadowDarkness:{set:function(a){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.");this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.");this.shadow.mapSize.height=a}}});Object.defineProperties(C.prototype,{length:{get:function(){console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."); +return this.array.length}}});Object.assign(G.prototype,{addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().");this.setIndex(a)},addDrawCall:function(a,b,c){void 0!==c&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.");console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup().");this.addGroup(a,b)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."); +this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}});Object.defineProperties(G.prototype,{drawcalls:{get:function(){console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups.");return this.groups}},offsets:{get:function(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups.");return this.groups}}}); +Object.defineProperties(U.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(a){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){console.warn("THREE."+this.type+": .wrapRGB has been removed.");return new O}}});Object.defineProperties(db.prototype,{metal:{get:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.");return!1},set:function(a){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}); +Object.defineProperties(Fa.prototype,{derivatives:{get:function(){console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");return this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.");this.extensions.derivatives=a}}});sa.prototype=Object.assign(Object.create({constructor:sa,apply:function(a){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."); +Object.assign(a,this)}}),sa.prototype);Object.defineProperties(Ae.prototype,{dynamic:{set:function(a){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.");return this}}});Object.assign(Dd.prototype,{supportsFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."); +return this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");return this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).");return this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."); +return this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).");return this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).");return this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return this.capabilities.vertexTextures}, +supportsInstancedArrays:function(){console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).");return this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().");this.setScissorTest(a)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}, +addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}});Object.defineProperties(Dd.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.");this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."); +this.shadowMap.type=a}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.");this.shadowMap.cullFace=a}}});Object.defineProperties(pe.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+a+".");this.renderReverseSided=a}}});Object.defineProperties(Db.prototype, +{wrapS:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");return this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.");this.texture.wrapS=a}},wrapT:{get:function(){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");return this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.");this.texture.wrapT=a}},magFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."); +return this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.");this.texture.magFilter=a}},minFilter:{get:function(){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");return this.texture.minFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.");this.texture.minFilter=a}},anisotropy:{get:function(){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."); +return this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.");this.texture.anisotropy=a}},offset:{get:function(){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");return this.texture.offset},set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset.");this.texture.offset=a}},repeat:{get:function(){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");return this.texture.repeat}, +set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat.");this.texture.repeat=a}},format:{get:function(){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");return this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format.");this.texture.format=a}},type:{get:function(){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type.");return this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."); +this.texture.type=a}},generateMipmaps:{get:function(){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");return this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.");this.texture.generateMipmaps=a}}});Object.assign(dc.prototype,{load:function(a){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var b=this;(new Od).load(a,function(a){b.setBuffer(a)}); +return this}});Object.assign(Rd.prototype,{getData:function(a){console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData().");return this.getFrequencyData()}});l.WebGLRenderTargetCube=Eb;l.WebGLRenderTarget=Db;l.WebGLRenderer=Dd;l.ShaderLib=Gb;l.UniformsLib=W;l.UniformsUtils=La;l.ShaderChunk=X;l.FogExp2=Ib;l.Fog=Jb;l.Scene=jb;l.LensFlare=Ed;l.Sprite=qc;l.LOD=rc;l.SkinnedMesh=dd;l.Skeleton=bd;l.Bone=cd;l.Mesh=ya;l.LineSegments=la;l.Line=Ta;l.Points=Kb;l.Group=sc;l.VideoTexture=ed;l.DataTexture= +lb;l.CompressedTexture=Lb;l.CubeTexture=Xa;l.CanvasTexture=fd;l.DepthTexture=tc;l.TextureIdCount=function(){return ee++};l.Texture=da;l.MaterialIdCount=function(){return oe++};l.CompressedTextureLoader=we;l.BinaryTextureLoader=Gd;l.DataTextureLoader=Gd;l.CubeTextureLoader=Hd;l.TextureLoader=gd;l.ObjectLoader=xe;l.MaterialLoader=ud;l.BufferGeometryLoader=Id;l.DefaultLoadingManager=Ga;l.LoadingManager=Fd;l.JSONLoader=Jd;l.ImageLoader=Lc;l.FontLoader=ye;l.XHRLoader=Ja;l.Loader=wb;l.Cache=ce;l.AudioLoader= +Od;l.SpotLightShadow=id;l.SpotLight=jd;l.PointLight=kd;l.HemisphereLight=hd;l.DirectionalLightShadow=ld;l.DirectionalLight=md;l.AmbientLight=nd;l.LightShadow=tb;l.Light=pa;l.StereoCamera=ze;l.PerspectiveCamera=Ea;l.OrthographicCamera=Hb;l.CubeCamera=vd;l.Camera=Z;l.AudioListener=Pd;l.PositionalAudio=Qd;l.getAudioContext=Md;l.AudioAnalyser=Rd;l.Audio=dc;l.VectorKeyframeTrack=bc;l.StringKeyframeTrack=rd;l.QuaternionKeyframeTrack=Nc;l.NumberKeyframeTrack=cc;l.ColorKeyframeTrack=td;l.BooleanKeyframeTrack= +sd;l.PropertyMixer=wd;l.PropertyBinding=fa;l.KeyframeTrack=vb;l.AnimationUtils=ma;l.AnimationObjectGroup=Sd;l.AnimationMixer=Ud;l.AnimationClip=Ha;l.Uniform=Ae;l.InstancedBufferGeometry=Bb;l.BufferGeometry=G;l.GeometryIdCount=function(){return ad++};l.Geometry=Q;l.InterleavedBufferAttribute=Vd;l.InstancedInterleavedBuffer=fc;l.InterleavedBuffer=ec;l.InstancedBufferAttribute=gc;l.DynamicBufferAttribute=function(a,b){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."); +return(new C(a,b)).setDynamic(!0)};l.Float64Attribute=function(a,b){return new C(new Float64Array(a),b)};l.Float32Attribute=ha;l.Uint32Attribute=$c;l.Int32Attribute=function(a,b){return new C(new Int32Array(a),b)};l.Uint16Attribute=Zc;l.Int16Attribute=function(a,b){return new C(new Int16Array(a),b)};l.Uint8ClampedAttribute=function(a,b){return new C(new Uint8ClampedArray(a),b)};l.Uint8Attribute=function(a,b){return new C(new Uint8Array(a),b)};l.Int8Attribute=function(a,b){return new C(new Int8Array(a), +b)};l.BufferAttribute=C;l.Face3=ea;l.Object3DIdCount=function(){return qe++};l.Object3D=z;l.Raycaster=Wd;l.Layers=Yc;l.EventDispatcher=sa;l.Clock=Yd;l.QuaternionLinearInterpolant=qd;l.LinearInterpolant=Mc;l.DiscreteInterpolant=pd;l.CubicInterpolant=od;l.Interpolant=qa;l.Triangle=wa;l.Spline=function(a){function b(a,b,c,d,e,f,g){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,k,l,w,n,p;this.initFromArray=function(a){this.points=[]; +for(var b=0;bthis.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:f+2;l=this.points[c[0]];w=this.points[c[1]];n=this.points[c[2]];p=this.points[c[3]];h=g*g;k=g*h;d.x=b(l.x,w.x,n.x,p.x,g,h,k);d.y=b(l.y,w.y,n.y,p.y,g,h,k);d.z=b(l.z,w.z,n.z,p.z,g,h,k);return d};this.getControlPointsArray=function(){var a, +b,c=this.points.length,d=[];for(a=0;a + + + + + Maze 3D + + + + + + + sharing image +
+
+
+ +
+
+ + + +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/Bubble_game/.vscode/settings.json b/Bubble_game/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/Bubble_game/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/Bubble_game/index.html b/Bubble_game/index.html new file mode 100644 index 0000000..1d8c6c1 --- /dev/null +++ b/Bubble_game/index.html @@ -0,0 +1,36 @@ + + + + + + + + Bubble Game + + + +
+
+
+
+

Hit

+
5
+
+
+

Timer

+
60
+
+
+

Score

+
7
+
+
+
+ + +
+
+
+ + + \ No newline at end of file diff --git a/Bubble_game/script.js b/Bubble_game/script.js new file mode 100644 index 0000000..3fa4f4c --- /dev/null +++ b/Bubble_game/script.js @@ -0,0 +1,51 @@ + +var timer = 60; +var score = 0; +var hitrn = 0; +function increaseScore(){ + score += 10; + document.querySelector('#scoreval').textContent = score; +} + +function getNewHit(){ + hitrn = Math.floor(Math.random()*10); + document.querySelector('#hitval').textContent = hitrn; +} + +function makeBubble(){ +clutter= ""; +for(i=1;i<=185;i++){ + var rn = Math.floor(Math.random()*10); + clutter += `
${rn}
`; +} +document.querySelector('#pbtm').innerHTML=clutter; + +}; + +function runTimer(){ + var timerint = setInterval(function(){ + if(timer>0){ + timer--; + document.querySelector('#timerval').textContent = timer; + } + else{ + clearInterval(timerint); + document.querySelector('#pbtm').innerHTML = `

Game Over

` + } + + },1000); +} + +document.querySelector("#pbtm").addEventListener("click",function(dets){ + var clickedNumber = Number(dets.target.textContent); + if(clickedNumber === hitrn){ + increaseScore(); + getNewHit(); + makeBubble(); + } +}); + +runTimer(); +makeBubble(); +getNewHit(); +increaseScore(); \ No newline at end of file diff --git a/Bubble_game/style.css b/Bubble_game/style.css new file mode 100644 index 0000000..38cb250 --- /dev/null +++ b/Bubble_game/style.css @@ -0,0 +1,88 @@ +*{ + margin: 0; + padding: 0; + font-family: "Gilroy"; + box-sizing: border-box; +} + +html,body{ + height: 100%; + width: 100%; +} + +#main{ + display: flex; + justify-content: center; + align-items: center; + height: 100%; + width: 100%; + background-color: rgb(195, 249, 195); +} + +#panel +{ + height: 80%; + width: 90%; + background-color: #fff; + border-radius: 10px; + overflow: hidden; +} + +#ptop{ + padding: 0px 30%; + display: flex; + align-items: center; + color: #fff; + justify-content: space-between; + width: 100%; + height: 100px; + background-color: rgb(56, 245, 56); +} +.elem{ + + display: flex; + align-items: center; + gap: 20px; +} +.elem h2{ + font-weight: 600; + font-size: 22px; +} + +.box{ + color: rgb(10, 178, 38); + font-weight: 600; + font-size: 25px; + padding: 10px 20px; + background-color: #fff; + border-radius: 5px; + +} + +#pbtm{ + flex-wrap: wrap; + display: flex; + justify-content: center; + align-items: center; + gap: 10px; + padding: 20px; + width: 100%; + height:calc(100% - 100px); + +} + +.bubble{ + display: flex; + justify-content: center; + align-items: center; + width: 40px; + height: 40px; + background-color: rgb(10, 178, 38); + border-radius: 50%; + font-weight: 500; +} + +.bubble:hover{ + cursor: pointer; + background-color:chocolate; +} \ No newline at end of file diff --git a/Chrome Extension for Live Cricket News/index.html b/Chrome Extension for Live Cricket News/index.html new file mode 100644 index 0000000..4b3f903 --- /dev/null +++ b/Chrome Extension for Live Cricket News/index.html @@ -0,0 +1,19 @@ + + + + + + + + My Chrome Extension + + + +

Welcome

+
    +
  • + +
+ + + \ No newline at end of file diff --git a/Chrome Extension for Live Cricket News/manifest.json b/Chrome Extension for Live Cricket News/manifest.json new file mode 100644 index 0000000..1a13ec1 --- /dev/null +++ b/Chrome Extension for Live Cricket News/manifest.json @@ -0,0 +1,11 @@ +{ + "name":"Arpcoder's Extension", + "version":"1.0.0", + "description":"Cricket Updates", + "manifest_version":3, + "author":"Arpna", + "action":{ + "default_popup":"index.html", + "default_title":"Chrome Extension" + } +} \ No newline at end of file diff --git a/Chrome Extension for Live Cricket News/script.js b/Chrome Extension for Live Cricket News/script.js new file mode 100644 index 0000000..c4c1af7 --- /dev/null +++ b/Chrome Extension for Live Cricket News/script.js @@ -0,0 +1,24 @@ +async function getData() { + return await fetch("https://api.cricapi.com/v1/currentMatches?[APIKEY]") + .then(data => data.json()) + .then(data => { + if (data.status != "success") + return; + + const dataList = data.data + + if (!dataList) + return []; + + const releventData = dataList.map(match => `${match.name},${match.status}`); + + console.log({ releventData }); + document.getElementById("matches").innerHTML = releventData.map(match => `
  • ${match}
  • `).join(''); + + return releventData; + }) + + .catch(e=>console.log(e)); +} + +getData(); \ No newline at end of file diff --git a/Chrome Extension for Live Cricket News/style.css b/Chrome Extension for Live Cricket News/style.css new file mode 100644 index 0000000..90f691e --- /dev/null +++ b/Chrome Extension for Live Cricket News/style.css @@ -0,0 +1,11 @@ +body { + min-width: 400px; + /* background-color: black; */ + background-image: url("https://img.freepik.com/free-vector/elegant-hand-drawn-golden-floral-seamless-pattern_44538-7004.jpg"); + background-repeat: no-repeat; + background-size: cover; + color: black; + font-weight: bold; + font-style:inherit; + font-size: medium; +} \ No newline at end of file diff --git a/Counter/index.html b/Counter/index.html new file mode 100644 index 0000000..528be83 --- /dev/null +++ b/Counter/index.html @@ -0,0 +1,21 @@ + + + + + + + + Counter + + + +
    +

    + + +

    +
    + + + + \ No newline at end of file diff --git a/Counter/script.js b/Counter/script.js new file mode 100644 index 0000000..024a186 --- /dev/null +++ b/Counter/script.js @@ -0,0 +1,36 @@ + +var productCounter = { + count: 0, + incrementCounter: function () { + if (this.count < 10) { + return this.count = this.count + 1; + } else { + alert("maximum limit reached, you can buy only 10 items"); + return this.count; + } + + }, + decrementCounter: function () { + if (this.count > 0) { + return this.count = this.count - 1; + } else { + return this.count = 0; + } + }, + resetCounter: function () { + return this.count = 0; + } + +}; + +var displayCout = document.getElementById('displayCounter'); +displayCout.innerHTML = 0; +document.getElementById('increment').onclick = function () { + displayCout.innerHTML = productCounter.incrementCounter(); +} +document.getElementById('decrement').onclick = function () { + displayCout.innerHTML = productCounter.decrementCounter(); +} +document.getElementById('reset').onclick = function () { + displayCout.innerHTML = productCounter.resetCounter(); +} diff --git a/Counter/style.css b/Counter/style.css new file mode 100644 index 0000000..4713536 --- /dev/null +++ b/Counter/style.css @@ -0,0 +1,22 @@ +#increment, #decrement, #reset { + padding: 10px 15px; + font-size: 18px; + background: #56ccf2; + background: -webkit-linear-gradient(to right, #56ccf2, #2f80ed); + background: linear-gradient(to right, #56ccf2, #2f80ed); + color: #f1f1f1; + border: none; + margin: 5px; +} + +#main { + margin: 0 auto; + text-align: center; + padding: 5% 10%; +} + +#displayCounter { + font-size: 100px; + font-family: impact; + +} \ No newline at end of file diff --git a/Crypto Price Tracker/bitcoin_logo.png b/Crypto Price Tracker/bitcoin_logo.png new file mode 100644 index 0000000..5788369 Binary files /dev/null and b/Crypto Price Tracker/bitcoin_logo.png differ diff --git a/Crypto Price Tracker/index.html b/Crypto Price Tracker/index.html new file mode 100644 index 0000000..2916e3d --- /dev/null +++ b/Crypto Price Tracker/index.html @@ -0,0 +1,26 @@ + + + + + + Cryptocurrency Price Tracker + + + + +
    +

    Cryptocurrency Price Tracker

    + + + + + + + + + +
    CoinPrice (USD)
    +
    + + + \ No newline at end of file diff --git a/Crypto Price Tracker/script.js b/Crypto Price Tracker/script.js new file mode 100644 index 0000000..f334e2d --- /dev/null +++ b/Crypto Price Tracker/script.js @@ -0,0 +1,50 @@ +const cryptoList = document.getElementById("cryptoList"); +let previousPrices = {}; + +async function fetchCryptoData() +{ + try + { + const response = await fetch("https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=15&page=1"); + const cryptoData = await response.json(); + + cryptoList.innerHTML = ""; + + cryptoData.forEach((crypto) => + { + const cryptoRow = document.createElement("tr"); + + const cryptoNameCell = document.createElement("td"); + cryptoNameCell.textContent = crypto.name; + cryptoNameCell.classList.add("crypto-name"); + + const cryptoPriceCell = document.createElement("td"); + const currentPrice = parseFloat(crypto.current_price); + const previousPrice = previousPrices[crypto.id] || currentPrice; + + cryptoPriceCell.textContent = `$${currentPrice.toFixed(2)}`; + cryptoPriceCell.classList.add(getPriceChangeClass(currentPrice, previousPrice)); // Apply the appropriate class + + cryptoRow.appendChild(cryptoNameCell); + cryptoRow.appendChild(cryptoPriceCell); + + cryptoList.appendChild(cryptoRow); + + previousPrices[crypto.id] = currentPrice; + }); + } + catch (error) + { + console.error("Error fetching cryptocurrency data:", error); + } +} + +function getPriceChangeClass(currentPrice, previousPrice) +{ + if (currentPrice > previousPrice) return "price-increase"; + else return "price-decrease"; +} + +fetchCryptoData(); + +setInterval(fetchCryptoData, 30000); \ No newline at end of file diff --git a/Crypto Price Tracker/style.css b/Crypto Price Tracker/style.css new file mode 100644 index 0000000..9ab35b6 --- /dev/null +++ b/Crypto Price Tracker/style.css @@ -0,0 +1,92 @@ +body, html +{ + margin: 0; + padding: 0; +} + +body +{ + font-family: Arial, sans-serif; + background: linear-gradient(45deg, #007BFF, #00BFFF); + background-size: cover; + background-attachment: fixed; + color: #fff; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + overflow: hidden; +} + +.container +{ + max-width: 800px; + margin: 0 auto; + padding: 20px; + background-color: #ffffff; + border-radius: 8px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); +} + +h1 +{ + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + color: #007BFF; + margin-bottom: 20px; + text-align: center; + transition: color 0.3s ease-in-out, text-shadow 0.3s ease-in-out; +} + +h1:hover +{ + color: #00BFFF; + text-shadow: 2px 2px 4px rgba(0, 0, 0, 1); +} + +.crypto-table +{ + width: 100%; + border-collapse: collapse; + margin-top: 20px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); +} + +.crypto-table th, +.crypto-table td +{ + padding: 10px; + text-align: left; +} + +.crypto-table th +{ + background-color: #007BFF; + color: white; +} + +.crypto-table tr:nth-child(even) +{ + background-color: #f2f2f2; +} + +.crypto-table tr:hover +{ + background-color: #d2d2d2; + transform: scale(1.02); + transition: transform 0.2s ease-in-out; +} + +.crypto-name +{ + color: #333; +} + +.price-increase +{ + color: green; +} + +.price-decrease +{ + color: red; +} \ No newline at end of file diff --git a/Digital Clock/css/style.css b/Digital Clock/css/style.css index 7fc3cf1..34407e4 100644 --- a/Digital Clock/css/style.css +++ b/Digital Clock/css/style.css @@ -7,6 +7,7 @@ .text1{ display: flex; justify-content: center; + align-items: center; font-size: 3rem; height: 100px; @@ -29,7 +30,6 @@ box-shadow: 15px 15px 3px #273938 ; } - html,body{ display: grid; height:100%; diff --git a/Digital Clock/digitalClock.html b/Digital Clock/digitalClock.html index ddadb8d..55d08fc 100644 --- a/Digital Clock/digitalClock.html +++ b/Digital Clock/digitalClock.html @@ -18,6 +18,8 @@ +
    +
    diff --git a/Digital Clock/js/script.js b/Digital Clock/js/script.js index 3f8fe75..ca73ca7 100644 --- a/Digital Clock/js/script.js +++ b/Digital Clock/js/script.js @@ -19,8 +19,11 @@ function updateClock() { const options12Hour = { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }; const time12Hour = date.toLocaleTimeString(undefined, options12Hour); + clock12.innerHTML = `${time12Hour}`; clock24.innerHTML = `${time24Hour}`; + + day.innerHTML = ` ${date}`; } diff --git a/Dragon's World Game/cover.png b/Dragon's World Game/cover.png new file mode 100644 index 0000000..b1f728e Binary files /dev/null and b/Dragon's World Game/cover.png differ diff --git a/Dragon's World Game/dragon.png b/Dragon's World Game/dragon.png new file mode 100644 index 0000000..d13a021 Binary files /dev/null and b/Dragon's World Game/dragon.png differ diff --git a/Dragon's World Game/index.html b/Dragon's World Game/index.html new file mode 100644 index 0000000..9e19cef --- /dev/null +++ b/Dragon's World Game/index.html @@ -0,0 +1,106 @@ + + + + + + + + + + + + + +

    Welcome to Dragon's world

    +
    +
    Game Over
    +
    Your score : 0
    +
    +
    +
    + + + + + + \ No newline at end of file diff --git a/Dragon's World Game/obstacle.png b/Dragon's World Game/obstacle.png new file mode 100644 index 0000000..3ce93ae Binary files /dev/null and b/Dragon's World Game/obstacle.png differ diff --git a/Dragon's World Game/style.css b/Dragon's World Game/style.css new file mode 100644 index 0000000..055a3d5 --- /dev/null +++ b/Dragon's World Game/style.css @@ -0,0 +1,100 @@ +/* CSS Reset */ +*{ + margin:0px; + padding:0px; +} +body { + /* Hides the bottom scrollbar */ + overflow: hidden; +} +/* Styling of the Game's Name */ +#gameName { + position: absolute; + top:30vh; + left:38vw; +} +/* Background image styling */ +.container { + background-image: url(cover.png); + background-size: cover; + width:100vw; + height:100vh; +} +/* ScoreCard Styling */ +#scorecount { + position: absolute; + top:20px; + right:20px; + background-color: black; + padding: 28px; + border-radius: 20px; + color: white; +} +/* Obstacle image styling and positioning */ +.obstacle { + background-image: url(obstacle.png); + background-size: cover; + width:154px; + height: 126px; + position: absolute; + bottom:0px; + right:120px; +} +/* Applying animation to the obstacle + so that it can move towards left */ +.animateobstacle { + animation: aniob 5s linear infinite; +} +@keyframes aniob { + 0% { + left:100vw; + } + 100% { + left:-10vw; + } +} +/* Dragon's styling */ +.dragon { + background-image: url(dragon.png); + background-size: cover; + width: 194px; + height: 126px; + position: absolute; + bottom:0px; + left:90px; +} +/* Applying animation to the dragon so +that it can save himself by jumping up */ +.animatedragon { + animation: ani 1s linear; +} +@keyframes ani { + 0% { + bottom:0px; + } + 25% { + bottom:150px; + } + 50% { + bottom:300px; + } + 75% { + bottom:211px; + } + 100% { + bottom:0px; + } +} +/* gameover styling and positioning */ +.gameover { + visibility: hidden; + font-family: 'Ubuntu', sans-serif; + position: absolute; + top: 50vh; + left: 35vw; + color: red; + font-weight: bold; + font-size: 6rem; + background-color: firebrick; + border-radius: 20px; +} \ No newline at end of file diff --git a/DrumKit/main.js b/DrumKit/main.js index b061d06..783adf3 100644 --- a/DrumKit/main.js +++ b/DrumKit/main.js @@ -1,18 +1,35 @@ -function playSound(n) { - const audio = document.querySelector(`audio[data-key="${n}"]`); - const key = document.querySelector(`.key[data-key="${n}"]`); + +function playSound(keyCode) { + const audio = document.querySelector(`audio[data-key="${keyCode}"]`); + const key = document.querySelector(`button[data-key="${keyCode}"]`); + + if (!audio) return; + key.classList.add("clicked"); + audio.currentTime = 0; + audio.play().catch(error => { + console.error("Error playing audio: ", error.message); + }); setTimeout(() => { key.classList.remove("clicked"); }, 300); +} - if (!audio) return; - audio.currentTime = 0; - audio.play(); +function handleKeyOrMouseClick(event) { + let keyCode; + + if (event.type === "keydown") { + keyCode = event.keyCode; + } else if (event.type === "click") { + keyCode = parseInt(event.target.getAttribute("data-key")); + } + + playSound(keyCode); } -window.document.addEventListener("keydown", (e) => { - console.log(e.key, e.key.toUpperCase().charCodeAt(0)); - playSound(e.key.toUpperCase().charCodeAt(0)); +window.addEventListener("keydown", handleKeyOrMouseClick); +const keys = document.querySelectorAll(".key"); +keys.forEach(key => { + key.addEventListener("click", handleKeyOrMouseClick); }); diff --git a/DrumKit/style.css b/DrumKit/style.css index 2a77c62..4035813 100644 --- a/DrumKit/style.css +++ b/DrumKit/style.css @@ -26,7 +26,7 @@ main div { gap: 15px; } .key { - border: none; + border: 2px solid rgb(75, 64, 64); width: 110px; height: 100px; background-color: rgb(75, 64, 64); @@ -34,7 +34,8 @@ main div { transition: 0.3s; border-radius: 12px; } -.clicked { - scale: 1.1; +.key.clicked { + border-color: white; + transform: scale(1.1); opacity: 0.8; } diff --git a/Dynamic Quiz/index.html b/Dynamic Quiz/index.html new file mode 100644 index 0000000..476f9ea --- /dev/null +++ b/Dynamic Quiz/index.html @@ -0,0 +1,27 @@ + + + + Dynamic Quiz Project + + + + +
    +
    +

    Learning Js Properly: Project #1 - Dynamic Quiz

    +
    +
    +
    + + + + +
    + + + + + + diff --git a/Dynamic Quiz/script.js b/Dynamic Quiz/script.js new file mode 100644 index 0000000..105e3b2 --- /dev/null +++ b/Dynamic Quiz/script.js @@ -0,0 +1,167 @@ +(function () { + var questions = [{ + question: "What is 2*5?", + choices: [2, 5, 10, 15, 20], + correctAnswer: 2 + }, { + question: "What is 3*6?", + choices: [3, 6, 9, 12, 18], + correctAnswer: 4 + }, { + question: "What is 8*9?", + choices: [72, 99, 108, 134, 156], + correctAnswer: 0 + }, { + question: "What is 1*7?", + choices: [4, 5, 6, 7, 8], + correctAnswer: 3 + }, { + question: "What is 8*8?", + choices: [20, 30, 40, 50, 64], + correctAnswer: 4 + }]; + + var questionCounter = 0; //Tracks question number + var selections = []; //Array containing user choices + var quiz = $('#quiz'); //Quiz div object + + // Display initial question + displayNext(); + + // Click handler for the 'next' button + $('#next').on('click', function (e) { + e.preventDefault(); + + // Suspend click listener during fade animation + if (quiz.is(':animated')) { + return false; + } + choose(); + + // If no user selection, progress is stopped + if (isNaN(selections[questionCounter])) { + alert('Please make a selection!'); + } else { + questionCounter++; + displayNext(); + } + }); + + // Click handler for the 'prev' button + $('#prev').on('click', function (e) { + e.preventDefault(); + + if (quiz.is(':animated')) { + return false; + } + choose(); + questionCounter--; + displayNext(); + }); + + // Click handler for the 'Start Over' button + $('#start').on('click', function (e) { + e.preventDefault(); + + if (quiz.is(':animated')) { + return false; + } + questionCounter = 0; + selections = []; + displayNext(); + $('#start').hide(); + }); + + // Animates buttons on hover + $('.button').on('mouseenter', function () { + $(this).addClass('active'); + }); + $('.button').on('mouseleave', function () { + $(this).removeClass('active'); + }); + + // Creates and returns the div that contains the questions and + // the answer selections + function createQuestionElement(index) { + var qElement = $('
    ', { + id: 'question' + }); + + var header = $('

    Question ' + (index + 1) + ':

    '); + qElement.append(header); + + var question = $('

    ').append(questions[index].question); + qElement.append(question); + + var radioButtons = createRadios(index); + qElement.append(radioButtons); + + return qElement; + } + + // Creates a list of the answer choices as radio inputs + function createRadios(index) { + var radioList = $('

      '); + var item; + var input = ''; + for (var i = 0; i < questions[index].choices.length; i++) { + item = $('
    • '); + input = ''; + input += questions[index].choices[i]; + item.append(input); + radioList.append(item); + } + return radioList; + } + + // Reads the user selection and pushes the value to an array + function choose() { + selections[questionCounter] = +$('input[name="answer"]:checked').val(); + } + + // Displays next requested element + function displayNext() { + quiz.fadeOut(function () { + $('#question').remove(); + + if (questionCounter < questions.length) { + var nextQuestion = createQuestionElement(questionCounter); + quiz.append(nextQuestion).fadeIn(); + if (!(isNaN(selections[questionCounter]))) { + $('input[value=' + selections[questionCounter] + ']').prop('checked', true); + } + + // Controls display of 'prev' button + if (questionCounter === 1) { + $('#prev').show(); + } else if (questionCounter === 0) { + + $('#prev').hide(); + $('#next').show(); + } + } else { + var scoreElem = displayScore(); + quiz.append(scoreElem).fadeIn(); + $('#next').hide(); + $('#prev').hide(); + $('#start').show(); + } + }); + } + + // Computes score and returns a paragraph element to be displayed + function displayScore() { + var score = $('

      ', { id: 'question' }); + + var numCorrect = 0; + for (var i = 0; i < selections.length; i++) { + if (selections[i] === questions[i].correctAnswer) { + numCorrect++; + } + } + + score.append('You got ' + numCorrect + ' questions out of ' + + questions.length + ' right!!!'); + return score; + } +})(); \ No newline at end of file diff --git a/Dynamic Quiz/style.css b/Dynamic Quiz/style.css new file mode 100644 index 0000000..2423ac7 --- /dev/null +++ b/Dynamic Quiz/style.css @@ -0,0 +1,71 @@ +body { + font-family: Open Sans; +} + +h1 { + text-align: center; +} + +#title { + text-decoration: underline; +} + +#quiz { + text-indent: 10px; + display: none; +} + +.button { + border: 4px solid; + border-radius: 5px; + width: 40px; + padding-left: 5px; + padding-right: 5px; + position: relative; + float: right; + background-color: #DCDCDC; + color: black; + margin: 0 2px 0 2px; +} + +.button.active { + background-color: #F8F8FF; + color: #525252; +} + +button { + position: relative; + float: right; +} + +.button a { + text-decoration: none; + color: black; +} + +#container { + width: 50%; + margin: auto; + padding: 0 25px 40px 10px; + background-color: #1E90FF; + border: 4px solid #B0E0E6; + border-radius: 5px; + color: #FFFFFF; + font-weight: bold; + box-shadow: 5px 5px 5px #888; +} + +ul { + list-style-type: none; + padding: 0; + margin: 0; +} + +#prev { + display: none; +} + +#start { + display: none; + width: 90px; +} \ No newline at end of file diff --git a/Emoji_Charades/images/Emoji_Charades.jpg b/Emoji_Charades/images/Emoji_Charades.jpg new file mode 100644 index 0000000..66afd01 Binary files /dev/null and b/Emoji_Charades/images/Emoji_Charades.jpg differ diff --git a/Emoji_Charades/index.html b/Emoji_Charades/index.html new file mode 100644 index 0000000..5eda488 --- /dev/null +++ b/Emoji_Charades/index.html @@ -0,0 +1,23 @@ + + + + + + + Emoji Charades + + + + +

      Emoji Charades

      +

      Score: 0

      +
      + +
      + + +
      + + + + \ No newline at end of file diff --git a/Emoji_Charades/script.js b/Emoji_Charades/script.js new file mode 100644 index 0000000..b525f61 --- /dev/null +++ b/Emoji_Charades/script.js @@ -0,0 +1,99 @@ +// List of emoji and corresponding answers +const emojiList = [ + { emoji: "🍎🍏", answer: "apple" }, + { emoji: "🐱🐶", answer: "pets" }, + { emoji: "🌞🏖️", answer: "summer" }, + { emoji: "📚🎓", answer: "education" }, + { emoji: "🍕🍔", answer: "fast food" }, + { emoji: "🌈🦄", answer: "rainbow" }, + { emoji: "🎮🕹️", answer: "video games" }, + { emoji: "📷📸", answer: "photography" }, + { emoji: "🚗🛣️", answer: "road trip" }, + { emoji: "🌙🌟", answer: "starry night" }, + { emoji: "🎉🎊", answer: "celebration" }, + { emoji: "🌍🌱", answer: "environment" }, + { emoji: "☕📚", answer: "coffee and books" }, + { emoji: "🌼🐝", answer: "flowers and bees" }, + { emoji: "🍦🎂", answer: "ice cream cake" }, + { emoji: "🌺🌴", answer: "tropical paradise" }, + { emoji: "🎈🎁", answer: "birthday party" }, + { emoji: "🌞🌊", answer: "sunshine and beach" }, + { emoji: "🐼🎋", answer: "panda and bamboo" }, + { emoji: "🚀🌕", answer: "moon landing" }, + { emoji: "🎭🎟️", answer: "theater tickets" }, + { emoji: "📺🍿", answer: "movie night" }, + { emoji: "🌮🌯", answer: "taco and burrito" }, + { emoji: "🎵🎶", answer: "music festival" }, + { emoji: "🌈🍀", answer: "luck of the Irish" }, + { emoji: "📚📝", answer: "study notes" }, + { emoji: "🎮👾", answer: "video game characters" }, + { emoji: "🏰👑", answer: "royal castle" }, + { emoji: "🎤🎵", answer: "singing performance" }, + { emoji: "🍩☕", answer: "coffee and donuts" }, + { emoji: "🐠🐟", answer: "underwater world" }, + { emoji: "🌴🏖️", answer: "palm tree beach" }, + { emoji: "🎭🎬", answer: "theater play" }, + { emoji: "🍔🍟", answer: "burger and fries" }, + { emoji: "🌞🌻", answer: "sunflower" }, + { emoji: "🎣🐠", answer: "fishing" }, + { emoji: "📸🌇", answer: "cityscape photography" }, + { emoji: "🍩🍫", answer: "chocolate donut" }, + { emoji: "🚲🌳", answer: "bike ride in the park" }, + { emoji: "🎭🤡", answer: "circus performance" }, + { emoji: "🎉🎁", answer: "birthday celebration" }, + { emoji: "🏰👸", answer: "fairytale castle" }, + { emoji: "🌍✈️", answer: "world travel" }, + { emoji: "🍦🍨", answer: "ice cream delight" }, + { emoji: "🎮🕹️", answer: "gaming session" }, + { emoji: "🎭🎟️", answer: "theater show" }, + { emoji: "🌴🍹", answer: "tropical cocktail" }, +]; + +let currentQuestion; // Stores the current question +let score = 0; // Stores the player's score + +let winSound = new Audio("./sounds/correct.mp3"); +let wrongSound = new Audio("./sounds/wrong.mp3"); + +const guessInput = document.getElementById("guess-input"); + +// Select random emoji and set it as the current question +function selectRandomQuestion() { + currentQuestion = emojiList[Math.floor(Math.random() * emojiList.length)]; + document.getElementById("emoji").textContent = currentQuestion.emoji; +} + +guessInput.addEventListener("keypress", function (e) { + // If the user presses the "Enter" key on the keyboard + if (e.key === "Enter") { + e.preventDefault(); + document.getElementById("submit-btn").click(); + } +}); + +// Get user input and compare with the answer +document.getElementById("submit-btn").addEventListener("click", function () { + const resultDiv = document.getElementById("result"); + + const userGuess = guessInput.value.toLowerCase(); + const answer = currentQuestion.answer.toLowerCase(); + + if (userGuess === answer) { + winSound.play(); + resultDiv.textContent = "Correct!"; + resultDiv.style.color = "green"; + score++; + document.getElementById("score").textContent = score; + } else { + wrongSound.play(); + resultDiv.textContent = "Incorrect. Try again!"; + resultDiv.style.color = "red"; + } + + // Reset input field and select new random question + guessInput.value = ""; + selectRandomQuestion(); +}); + +// Call selectRandomQuestion() when the page loads +window.addEventListener("load", selectRandomQuestion); diff --git a/Emoji_Charades/sounds/correct.mp3 b/Emoji_Charades/sounds/correct.mp3 new file mode 100644 index 0000000..5c82f39 Binary files /dev/null and b/Emoji_Charades/sounds/correct.mp3 differ diff --git a/Emoji_Charades/sounds/wrong.mp3 b/Emoji_Charades/sounds/wrong.mp3 new file mode 100644 index 0000000..164e96e Binary files /dev/null and b/Emoji_Charades/sounds/wrong.mp3 differ diff --git a/Emoji_Charades/style.css b/Emoji_Charades/style.css new file mode 100644 index 0000000..d892fb9 --- /dev/null +++ b/Emoji_Charades/style.css @@ -0,0 +1,56 @@ +body { + text-align: center; + font-family: Arial, sans-serif; + background-image: url("./images/Emoji_Charades.jpg"); + background-size: cover; + background-position: center; + background-repeat: no-repeat; +} + +h1 { + color: #e57c23; + margin-top: 20px; +} + +#emoji-container { + font-size: 72px; + margin: 50px 0; +} + +#guess-input { + padding: 12px; + font-size: 16px; + width: 300px; + margin: 10px; +} + +.score { + color: #025464; +} + +#submit-btn { + padding: 12px 20px; + font-size: 16px; + background-color: #bebb0a; + color: #fff; + border: none; + cursor: pointer; + transition: background-color 0.3s ease; +} + +#submit-btn:hover { + background-color: #fffb09; +} + +#result { + margin-top: 20px; + font-weight: bold; + font-size: 21px; + color: #e8aa42; +} + +#score { + color: #e8aa42; + font-weight: bold; + font-size: 24px; +} diff --git a/Flappy_Bird/app.js b/Flappy_Bird/app.js new file mode 100644 index 0000000..cf5d155 --- /dev/null +++ b/Flappy_Bird/app.js @@ -0,0 +1,235 @@ +//===============board=============== + +let board; +let boardWidth=360; +let boardHeight=640; +let context; +let isGamePaused = true; +//==================bird======================= +let birdWidth=32;// width/height=60/45=4/3 +let birdHeight=24; +let birdX=boardWidth/8; +let birdY=boardHeight/2 ; +let birdImg; + +let bird = { + x:birdX, + y:birdY, + width:birdWidth, + height:birdHeight + +} + +//==================pipes==================== +let pipeArray=[]; +let pipeWidth=80; +let pipeHeight=500; +let pipeX=boardWidth; +let pipeY=0; + +let topPipeImg; +let bottomPipeImg; + +//=========physics========= +let velocityX= -2; //pipes moving left direction +let velocityY = -4; +let gravity = 0.2; + +let gameOver = false; +let score=0; + +window.onload= function(){ + board=document.getElementById("board"); + board.height =boardHeight; + board.width =boardWidth; + context= board.getContext("2d"); + + //=============draw flappy bird====================== + + // context.fillStyle="red"; + // context.fillRect(bird.x,bird.y,bird.width,bird.height); + + //loading image + birdImg = new Image(); + birdImg.src="./images/flappy-bird.png"; + birdImg.onload = function(){ + context.drawImage(birdImg,bird.x,bird.y,bird.width,bird.height); + } + //=========for pipes============== + + topPipeImg=new Image(); + topPipeImg.src="./images/flappybird-pipe.png"; + + bottomPipeImg=new Image(); + bottomPipeImg.src="./images/flappybird-pipe2.png"; + + requestAnimationFrame(update); + setInterval(placePipes,1500);// every 1.5s the pipe will be placed + document.addEventListener("keydown",moveBird); + showInstructions(); +} +document.addEventListener('keydown', function (e) { + if (e.code === 'KeyI') { + showInstructions(); + } + }); + // Function to show the instructions modal +function showInstructions() { + // Show the instructions modal + isGamePaused = true; + const instructionsModal = document.getElementById('instructionsModal'); + instructionsModal.style.display = 'block'; + + // Hide the canvas while showing the instructions + board.style.display = 'none'; + + // Event listener to start the game when the "Start Game" button is clicked + const startGameBtn = document.getElementById('startGameBtn'); + startGameBtn.addEventListener('click', closeInstructions); + } + + // Function to close the instructions modal and start the game + function closeInstructions() { + // Close the instructions modal + const instructionsModal = document.getElementById('instructionsModal'); + instructionsModal.style.display = 'none'; + + // Show the canvas and start the game + board.style.display = 'block'; + isGamePaused = false; + // Start the game + startGame(); + } + // Function to start the game +function startGame() { + // Add your game initialization logic here + // For example, you can start your game loop or set game variables. + + // Example: + // Initialize game variables + gameOver = false; + score = 0; + bird.y = birdY; + pipeArray = []; + + // Start your game loop or any necessary game logic here + requestAnimationFrame(update); + } +function update(){ + requestAnimationFrame(update); + if (isGamePaused) { // Check if the game is paused + return; + } + if(gameOver){ + return; + } + context.clearRect(0,0,board.width,board.height); + + //bird + velocityY+=gravity; + // bird.y+=velocityY; + bird.y=Math.max(bird.y+velocityY,0); + context.drawImage(birdImg,bird.x,bird.y,bird.width,bird.height); + + if(bird.y > board.height){ + gameOver=true; + } + + //pipes + for(let i=0;i< pipeArray.length;i++){ + let pipe=pipeArray[i]; + pipe.x +=velocityX; + context.drawImage(pipe.img,pipe.x,pipe.y,pipe.width,pipe.height); + + + if(!pipe.passed && bird.x > pipe.x +pipe.width){ + score+=.5; + pipe.passed=true; + } + + if(detectCollision(bird,pipe)){ + gameOver=true; + } + } + + //clear pipes + while(pipeArray.length >0 && pipeArray[0].x<-pipeWidth){ + pipeArray.shift();//remves the first element of the array + } + + //score + + context.fillStyle = "white"; + context.font = "45px sans-serif"; + context.fillText(score ,5,45); + + if(gameOver){ + context.fillText("GAME OVER",5,90); + // context.fillText("YOUR SCORE IS "+score,5,135 ); + } + +} + +function placePipes(){ + + if(gameOver){ + return; + } + let randomPipeY =pipeY - pipeHeight/4 - Math.random()*(pipeHeight/2); + let openingSpace=board.height/4; + + + + let topPipe={ + img :topPipeImg, + x: pipeX, + y:randomPipeY , + width :pipeWidth, + height:pipeHeight, + passed :false + } + + pipeArray.push(topPipe); + + let bottomPipe={ + img :bottomPipeImg, + x :pipeX, + y : randomPipeY +pipeHeight+openingSpace, + width:pipeWidth, + height:pipeHeight, + passed:false + + } + + pipeArray.push(bottomPipe); +} +// Function to start the game +function startGame() { + gameOver = false; + score = 0; + bird.y = birdY; + pipeArray = []; + } +function moveBird(e){ + if(e.code=="Space" || e.code=="ArrowUp" || e.code=="KeyX"){ + if (!isGamePaused) { // Check if the game is not paused + // Jump + velocityY = -6; // Adjust jump strength as needed + } + else if (e.code == "KeyI") { + // Toggle game pause on 'I' key press + isGamePaused = !isGamePaused; + } + if(gameOver){ + startGame(); + } + + } +} + +function detectCollision(a,b){ + return a.x < b.x + b.width && + a.x + a.width > b.x && + a.y < b.y + b.height && + a.y +a.height> b.y +} \ No newline at end of file diff --git a/Flappy_Bird/images/bottom-background.png b/Flappy_Bird/images/bottom-background.png new file mode 100644 index 0000000..623c1a7 Binary files /dev/null and b/Flappy_Bird/images/bottom-background.png differ diff --git a/Flappy_Bird/images/fb-game-background.png b/Flappy_Bird/images/fb-game-background.png new file mode 100644 index 0000000..2d878c6 Binary files /dev/null and b/Flappy_Bird/images/fb-game-background.png differ diff --git a/Flappy_Bird/images/flappy-bird.png b/Flappy_Bird/images/flappy-bird.png new file mode 100644 index 0000000..10b77c7 Binary files /dev/null and b/Flappy_Bird/images/flappy-bird.png differ diff --git a/Flappy_Bird/images/flappybird-pipe.png b/Flappy_Bird/images/flappybird-pipe.png new file mode 100644 index 0000000..06c7f75 Binary files /dev/null and b/Flappy_Bird/images/flappybird-pipe.png differ diff --git a/Flappy_Bird/images/flappybird-pipe2.png b/Flappy_Bird/images/flappybird-pipe2.png new file mode 100644 index 0000000..418d5d8 Binary files /dev/null and b/Flappy_Bird/images/flappybird-pipe2.png differ diff --git a/Flappy_Bird/index.html b/Flappy_Bird/index.html new file mode 100644 index 0000000..f100ece --- /dev/null +++ b/Flappy_Bird/index.html @@ -0,0 +1,25 @@ + + + + + + Flappy Bird Game + + + + + + + + +
      + + + \ No newline at end of file diff --git a/Flappy_Bird/style.css b/Flappy_Bird/style.css new file mode 100644 index 0000000..2239dc6 --- /dev/null +++ b/Flappy_Bird/style.css @@ -0,0 +1,71 @@ +body { + text-align: center; + margin: 0; + padding: 0; + font-family: Arial, sans-serif; + background-color: #f0f0f0; + overflow: hidden; /* Prevent scrollbar */ + } +#board{ + position: relative; + background-image: url("./images/fb-game-background.png"); + margin: 0 auto; + display: block; +} +#ground{ + position: relative; + background-image: url("./images/bottom-background.png"); + width: 360px; + height: 50px; + margin: 0 auto; +} +/* Instructions Modal */ +.modal { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.7); + z-index: 1; + overflow: auto; + } + .modal-content { + background-color: #fff; + margin: 15% auto; + padding: 20px; + border: 1px solid #888; + width: 60%; + max-width: 400px; + border-radius: 5px; + text-align: center; + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); + } + + .modal h2 { + font-size: 24px; + margin-bottom: 20px; + } + + .modal p { + font-size: 16px; + margin-bottom: 20px; + } + + #startGameBtn { + background-color: #008CBA; + color: #fff; + border: none; + padding: 10px 20px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + border-radius: 5px; + cursor: pointer; + transition: background-color 0.3s; + } + #startGameBtn:hover { + background-color: #005F7F; + } \ No newline at end of file diff --git a/GitHub Card/css/style.css b/GitHub Card/css/style.css index 101083f..b29eec5 100644 --- a/GitHub Card/css/style.css +++ b/GitHub Card/css/style.css @@ -1,41 +1,94 @@ -*{ +* { margin: 0; padding: 0; box-sizing: border-box; + font-family: "Space Mono", monospace; } -body{ - background-color: #212121; + +body { height: 100vh; + background-color: #141D2F; display: flex; + gap: 20px; + flex-direction: column; align-items: center; justify-content: center; font-family: "Outfit", sans-serif; } -.container{ + +.heading { + color: white; +} + +.container { + color: white; height: 300px; width: 500px; - background-color: rgb(0, 0, 0); - box-shadow: 10px 30px 40px rgba(87, 87, 87, 0.158); + gap: 1px; + background-color: #1e2a47; + + box-shadow: 10px 30px 40px rgba(43, 28, 94, 0.158); border-radius: 10px; display: flex; align-items: center; - justify-content: center; - flex-direction: column; - color: rgb(255, 249, 165); + justify-content: space-around; + + row-gap: 20px; } -.details{ + +.search-container { + box-shadow: 10px 30px 40px rgba(75, 69, 92, 0.194); + display: flex; + align-items: center; + border-radius: 20px; + justify-content: space-between; + padding: 8px 10px; + width: 500px; + background-color: #1e2a47; + +} + +.search-container-error { + border: 2px red solid; + +} + +.search-container input { + border: none; + outline: none; + background: transparent; + color: white; + font-size: 15px; + padding: 20px 15PX; +} + +.search-container button { + padding: 20px 20px; + color: white; + width: 100PX; + border-radius: 8px; + border: none; + outline: none; + cursor: pointer; + background-color: rgb(38, 75, 196); +} + +.search-container button:hover { + scale: 95%; +} + + +.details { display: flex; flex-direction: column; row-gap: 20px; } -.images{ - height: 100px; - width: 100px; - border-radius: 50%; -} -.images img{ - height: 100px; - width: 100px; + + + +.images img { + height: 150px; + width: 150px; border-radius: 50%; } \ No newline at end of file diff --git a/GitHub Card/js/script.js b/GitHub Card/js/script.js index 75d4f7d..1636716 100644 --- a/GitHub Card/js/script.js +++ b/GitHub Card/js/script.js @@ -1,17 +1,49 @@ -const requestURL = 'https://api.github.com/users/git21221'; + const image = document.querySelector('#image'); -const name = document.querySelector('.insertname'); +const newname = document.querySelector('.insertname'); +const following = document.querySelector('.insertfollowing'); const followers = document.querySelector('.insertfollowers'); const id = document.querySelector('.insertID'); -const xhr = new XMLHttpRequest(); -xhr.open('GET', requestURL); -xhr.onreadystatechange = () => { - if(xhr.readyState === 4){ - const apiInfo = JSON.parse(xhr.responseText); - image.setAttribute('src', apiInfo.avatar_url); - name.innerHTML = apiInfo.name; - followers.innerHTML = apiInfo.followers; - id.innerHTML = apiInfo.id; +const usernameInput = document.querySelector("#username"); + + + +async function profile(name = "shouryasinghrathore") { + try { + let response = await fetch(`https://api.github.com/users/${name}`); + + if (response.status === 404) { + profile(); + document.getElementById("inputValue").value = ""; + alert("Enter Valid Username"); + } else if (response.ok) { + let apiInfo = await response.json(); + console.log(apiInfo); + image.setAttribute('src', apiInfo.avatar_url); + newname.innerHTML = apiInfo.login; + console.log(apiInfo.login); + following.innerHTML = apiInfo.following; + followers.innerHTML = apiInfo.followers; + id.innerHTML = apiInfo.id; + } else { + console.error("Error fetching user data"); + alert("Error fetching user data"); + } + } catch (error) { + console.error("An error occurred:", error); } } -xhr.send(); \ No newline at end of file + + + +function processInput() { + let inputValue = document.getElementById("inputValue").value; + if (inputValue.trim() !== "") { + usernameInput.classList.remove("search-container-error"); + profile(inputValue); + } else { + usernameInput.classList.add("search-container-error"); + } +} + +profile(); \ No newline at end of file diff --git a/GitHub Card/workingwithapi.html b/GitHub Card/workingwithapi.html index aa8488f..47197b3 100644 --- a/GitHub Card/workingwithapi.html +++ b/GitHub Card/workingwithapi.html @@ -1,12 +1,19 @@ + - Card using API + Github Dev Finder + +

      Github Dev Finder

      +
      + + +
      user image @@ -16,13 +23,20 @@ Name:
      - Followers: + Followers: + +
      +
      + following: +
    + + \ No newline at end of file diff --git a/Guess The Image/Sumatran_Tiger_Berlin_Tierpark.webp b/Guess The Image/Sumatran_Tiger_Berlin_Tierpark.webp new file mode 100644 index 0000000..8a55f90 Binary files /dev/null and b/Guess The Image/Sumatran_Tiger_Berlin_Tierpark.webp differ diff --git a/Guess The Image/default.jpg b/Guess The Image/default.jpg new file mode 100644 index 0000000..16eaf8c Binary files /dev/null and b/Guess The Image/default.jpg differ diff --git a/Guess The Image/forest.jpg b/Guess The Image/forest.jpg new file mode 100644 index 0000000..d6b1280 Binary files /dev/null and b/Guess The Image/forest.jpg differ diff --git a/Guess The Image/gti.css b/Guess The Image/gti.css new file mode 100644 index 0000000..a2341be --- /dev/null +++ b/Guess The Image/gti.css @@ -0,0 +1,92 @@ +/* gti.css */ + +/* Reset some default styles */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +/* Set a base font size for better responsiveness */ +html { + font-size: 62.5%; +} + +/* Apply background and text styles */ +body { + background-image: url("forest.jpg"); + background-repeat: no-repeat; + background-size: cover; + font-family: 'Roboto'; + /* Added Google Font */ +} + +/* Header styles */ +.heading { + width: 100vw; + color: white; + display: flex; + justify-content: center; + align-items: center; + background-color: rgba(5, 5, 66,0); + margin-top: 20vh; + margin-right: auto; + margin-left: auto; + font-size: 5rem; +} + +/* Game container styles */ +.main { + width: 80rem; + /* Increased width */ + height: 20rem; + /* Increased height */ + margin-top: 12vh; + margin-right: auto; + margin-left: auto; + display: flex; + align-items: center; + justify-content: center; + background-color: rgb(5, 5, 66); + border-radius: 10px; + padding: 2rem; + box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.3); +} + +/* Image grid styles */ +.cImage { + width: 16rem; + height: 16rem; + cursor: pointer; + margin: 1rem; + border-radius: 50%; + transition: transform 0.2s ease-in-out; +} + +.cImage:hover { + transform: scale(1.1); +} + +/* Play again button styles */ +.playagain { + width: 25rem; + /* Increased width */ + padding: 1.5rem 2rem; + /* Increased padding */ + margin-right: auto; + margin-left: auto; + background-color: rgb(5, 5, 66); + margin-top: 2rem; + /* Increased top margin */ + font-size: 2rem; + display: flex; + color:white; + border-radius:4px; + justify-content: center; + cursor: pointer; + transition: background-color 0.2s; +} + +.playagain:hover { + background-color: #007bff; +} \ No newline at end of file diff --git a/Guess The Image/gti.js b/Guess The Image/gti.js new file mode 100644 index 0000000..1ae5eae --- /dev/null +++ b/Guess The Image/gti.js @@ -0,0 +1,73 @@ +let imagesno = [0, 1, 2, 3]; +let animals = ["deer", "tiger", "lion", "elephant"]; +let secretNumber = Math.trunc(Math.random() * 4); +let head = document.querySelector(".heading"); +head.textContent = `Guess the image of ${animals[secretNumber]}`; +const audio1 = new Audio("success.mp3"); +const audio2 = new Audio("wrong.mp3"); +let images = document.getElementsByClassName("cImage"); +let aimages = Array.from(images); +let images1 = document.querySelector("#I1"); +let images2 = document.querySelector("#I2"); +let images3 = document.querySelector("#I3"); +let images4 = document.querySelector("#I4"); +let flag = 0; +let pg = document.querySelector(".playagain"); + +pg.addEventListener("click", function () { + images1.addEventListener("click", game); + images2.addEventListener("click", game); + images3.addEventListener("click", game); + images4.addEventListener("click", game); + secretNumber = Math.trunc(Math.random() * 4); + head.textContent = `Guess the image of ${animals[secretNumber]}`; + // images1.src="default.jpg"; + // images2.src="default.jpg"; + // images3.src="default.jpg"; + aimages.forEach(function (i) { + i.src = "default.jpg"; + i.style.width = "16rem"; + i.style.height = "16rem"; + i.style.border = "none"; + i.style.margin = "1rem"; + + }); +}); +let game = function () { + function random_sort(a, b) { + return Math.random() - 0.5; + } + imagesno.sort(random_sort); + this.src = `img${imagesno[0]}.jpg`; + if (secretNumber === imagesno[0]) { + this.style.width = "10rem"; + this.style.height = "10rem"; + this.style.border = "2px solid yellow"; + this.style.marginRight = "10px"; + this.style.marginLeft = "10px"; + head.textContent = `Your guess was correct 🎉 }`; + audio1.play(); + images1.removeEventListener("click", game); + images2.removeEventListener("click", game); + images3.removeEventListener("click", game); + images4.removeEventListener("click", game); + flag = 1; + } else { + audio2.play(); + this.style.width = "10rem"; + this.style.height = "10rem"; + this.style.border = "2px solid red"; + this.style.marginRight = "10px"; + this.style.marginLeft = "10px"; + head.textContent = `sorry you lost 😞 `; + images1.removeEventListener("click", game); + images2.removeEventListener("click", game); + images3.removeEventListener("click", game); + images4.removeEventListener("click", game); + flag = 1; + } +}; +images1.addEventListener("click", game); +images2.addEventListener("click", game); +images3.addEventListener("click", game); +images4.addEventListener("click", game); diff --git a/Guess The Image/gueestheimage.html b/Guess The Image/gueestheimage.html new file mode 100644 index 0000000..c8a0b97 --- /dev/null +++ b/Guess The Image/gueestheimage.html @@ -0,0 +1,21 @@ + + + + + + + Document + + + +
    +
    + + + + +
    +
    Playagain
    + + + \ No newline at end of file diff --git a/Guess The Image/img0.jpg b/Guess The Image/img0.jpg new file mode 100644 index 0000000..6586007 Binary files /dev/null and b/Guess The Image/img0.jpg differ diff --git a/Guess The Image/img1.jpg b/Guess The Image/img1.jpg new file mode 100644 index 0000000..37b8324 Binary files /dev/null and b/Guess The Image/img1.jpg differ diff --git a/Guess The Image/img2.jpg b/Guess The Image/img2.jpg new file mode 100644 index 0000000..1616426 Binary files /dev/null and b/Guess The Image/img2.jpg differ diff --git a/Guess The Image/img3.jpg b/Guess The Image/img3.jpg new file mode 100644 index 0000000..eb78980 Binary files /dev/null and b/Guess The Image/img3.jpg differ diff --git a/Guess The Image/success.mp3 b/Guess The Image/success.mp3 new file mode 100644 index 0000000..68dad2d Binary files /dev/null and b/Guess The Image/success.mp3 differ diff --git a/Guess The Image/wrong.mp3 b/Guess The Image/wrong.mp3 new file mode 100644 index 0000000..cbc41a1 Binary files /dev/null and b/Guess The Image/wrong.mp3 differ diff --git a/Guess The Number/assets/end.mp3 b/Guess The Number/assets/end.mp3 new file mode 100644 index 0000000..8c2ed11 Binary files /dev/null and b/Guess The Number/assets/end.mp3 differ diff --git a/Guess The Number/assets/lose.mp3 b/Guess The Number/assets/lose.mp3 new file mode 100644 index 0000000..5442d5d Binary files /dev/null and b/Guess The Number/assets/lose.mp3 differ diff --git a/Guess The Number/assets/win.mp3 b/Guess The Number/assets/win.mp3 new file mode 100644 index 0000000..f7cadc8 Binary files /dev/null and b/Guess The Number/assets/win.mp3 differ diff --git a/Guess The Number/guessthenum.html b/Guess The Number/guessthenum.html index cc3e9fc..8c8fc6c 100644 --- a/Guess The Number/guessthenum.html +++ b/Guess The Number/guessthenum.html @@ -9,11 +9,15 @@ + + + +

    Try and Guess a random number between 1 to 100

    You have 10 attempts to guess correctly.

    Guess a number

    - +
    @@ -23,8 +27,9 @@

    Guess a number

    previous Guesses:
    Guesses remaining:
    -

    +

    + + - - \ No newline at end of file + diff --git a/Guess The Number/js/script.js b/Guess The Number/js/script.js index 1de5c0d..1fcf0ea 100644 --- a/Guess The Number/js/script.js +++ b/Guess The Number/js/script.js @@ -8,39 +8,65 @@ const loh = document.querySelector(".loworhigh"); const startOver = document.querySelector(".resultsec"); const code = document.querySelector("code"); const p = document.createElement('p'); +const winSound = document.getElementById('winSound'); +const loseSound = document.getElementById('loseSound'); +const endGameSound = document.getElementById('endGameSound'); let prevGuess = []; let numGuess = 1; let playGame = true; + +function playWinSound() { + winSound.play(); +} + +function playLoseSound() { + loseSound.play(); +} + +function playEndGameSound() { + endGameSound.play(); +} + submit.addEventListener('click', (e) => { e.preventDefault(); const guessNumber = parseInt(userValue.value); validateGuess(guessNumber); }); + function validateGuess(guessNumber) { - if (guessNumber < 1 || guessNumber > 100 || isNaN(guessNumber)) alert("please enter valid number"); - else { + if (guessNumber < 1 || guessNumber > 100 || isNaN(guessNumber)) { + alert("Please enter a valid number"); + } else { prevGuess.push(guessNumber); - if (numGuess === 11) { - displayMessege(`game over, random number was ${randomNumber}`); + if (numGuess === 11) { // Change the condition to 10 (no chances left) + displayMessage(`Game over, the random number was ${randomNumber}`); + playEndGameSound(); // Play end game sound endGame(); - } - else { + } else { displayGuess(guessNumber); checkGuess(guessNumber); } } } + function checkGuess(guessNumber) { if (guessNumber === randomNumber) { - displayMessege("You guessed right 🎉"); + displayMessage("You guessed right 🎉"); + playWinSound(); // Play win sound endGame(); + } else if (guessNumber < randomNumber) { + displayMessage(`Number is too low`); + playLoseSound(); // Play lose sound (optional) + } else if (guessNumber > randomNumber) { + displayMessage(`Number is too high`); + playLoseSound(); // Play lose sound (optional) } - else if (guessNumber < randomNumber) displayMessege(`Number is too low`); - else if (guessNumber > randomNumber) displayMessege(`Number is too high`); } -function displayMessege(messege) { - loh.innerHTML = `

    ${messege}

    `; + +function displayMessage(message) { + loh.innerHTML = `

    ${message}

    `; } + function displayGuess(guessNumber) { userValue.value = ''; guessSlot.innerHTML += `${guessNumber} `; @@ -48,15 +74,17 @@ function displayGuess(guessNumber) { lastResult.innerHTML = `${11 - numGuess}`; code.innerHTML = `${11 - numGuess}`; } -function endGame(){ + +function endGame() { userValue.value = ''; userValue.setAttribute('disabled', ''); p.classList.add('button'); p.innerHTML = `

    Start a new game

    `; startOver.appendChild(p); playGame = false; - newGame(); + newGame(); // Move playEndGameSound() to newGame() } + function newGame() { const newGamebtn = document.querySelector('#newGame'); newGamebtn.addEventListener('click', () => { @@ -69,7 +97,7 @@ function newGame() { code.innerHTML = 10; userValue.removeAttribute('disabled'); startOver.removeChild(p); - loh.textContent=""; + loh.textContent = ""; playGame = true; }); } \ No newline at end of file diff --git a/Home Page/i1.jpg b/Home Page/i1.jpg new file mode 100644 index 0000000..55a1a9e Binary files /dev/null and b/Home Page/i1.jpg differ diff --git a/Home Page/index.html b/Home Page/index.html new file mode 100644 index 0000000..4d09588 --- /dev/null +++ b/Home Page/index.html @@ -0,0 +1,83 @@ + + + + + + JavaScript_projects + + + + + +
    +

    JavaScript_projects

    +
    +
    +
    +
    + + + 2D archery game + + + + + Blackjack_game + Blackjack_game + Bouncing Balls + Chatroom Application + Color Changing Background + CountDown Timer + Credit Card Validate + Currency Converter + Dice-Game + DrumKit + GitHub Card + Guess The Number + HangMan + Heart pop up + JS Calculator + JS bubble Game + JavaScript Pairs Game + Joke_generator + MovieApp + Music App + Music Player + Quote Generator + Race Game + RockPaperScissor + Scramble words + Simon_Game + Snake Game + Speech_detection + Text-to-Speech + Tic Tac Toe + Timer + To Do List + Unlimited Color + Weather App + Wekipidia_clone + analog clock + authentication + calender + code visualizer + lineheight and letter spacing + css shadow generator + video-calling application + +
    +
    + + + + + + + + + + diff --git a/Home Page/style.css b/Home Page/style.css new file mode 100644 index 0000000..9fe0be1 --- /dev/null +++ b/Home Page/style.css @@ -0,0 +1,64 @@ + +body, h1 { + margin: 0; + padding: 0; + +} +body { + font-family: Arial, sans-serif; + background:url("i1.jpg"); + background-size: cover; + background-repeat: no-repeat; + background-attachment: fixed; } + + + +header { + background-color: #115794; + color: white; + text-align: center; + padding: 25px; +} + +main { + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; +} + +.project-container { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 10px; +} + +.project-label { + padding: 10px 20px; + border-radius: 50px; + cursor: pointer; + text-align: center; + transition: background-color 0.3s ease; +} + + +.blue-label { + background-color: #0074D9; + color: rgb(247, 246, 246); +} + +.red-label { + background-color: #ad712c; + color: white; +} + +.green-label { + background-color: #3CB371; + color: white; +} + + +.project-label:hover { + background-color: #7e3434; +} diff --git a/Image Slider/index.html b/Image Slider/index.html new file mode 100644 index 0000000..fd2dea2 --- /dev/null +++ b/Image Slider/index.html @@ -0,0 +1,60 @@ + + + + + + + + Image Slider + + + +
    + + + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    + + + + \ No newline at end of file diff --git a/Image Slider/script.js b/Image Slider/script.js new file mode 100644 index 0000000..561e226 --- /dev/null +++ b/Image Slider/script.js @@ -0,0 +1,4 @@ +var imageFunction = (backgroundImg) => { + var fullContainerImg = document.getElementById("image-container") + fullContainerImg.src = backgroundImg.src +} \ No newline at end of file diff --git a/Image Slider/style.css b/Image Slider/style.css new file mode 100644 index 0000000..e327ada --- /dev/null +++ b/Image Slider/style.css @@ -0,0 +1,54 @@ +*{ + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body{ + height: 100vh; + width: 100%; + display: flex; + justify-content: center; + align-items: center; + background: #141414; +} + +.shared{ + border: 3px solid whitesmoke; + border-radius: 10px; + overflow: hidden; +} + +img{ + height: 100%; + filter: grayscale(100%) +} + +.container{ + position: relative; + height: 600px; + width: 600px; + display: flex; + justify-content: center; + align-items: center; +} + +.container > img{ + position: absolute; + left: 0; + width: 100%; + object-fit: cover; +} + +.container .box{ + width: 50%; + height: 50%; + display: flex; + z-index: 1; +} + +.container .box .image-box{ + height: 100%; + width: calc(100% / 7); + cursor: pointer; +} \ No newline at end of file diff --git a/JavaScript Pairs Game/index.html b/JavaScript Pairs Game/index.html index ee94b7a..a41372c 100644 --- a/JavaScript Pairs Game/index.html +++ b/JavaScript Pairs Game/index.html @@ -9,13 +9,14 @@

    JavaScript pairs Game

    -

    Click any card to begin

    +

    Click Start

    00:00

    -
    -
    + + +
    \ No newline at end of file diff --git a/JavaScript Pairs Game/script.js b/JavaScript Pairs Game/script.js index df45555..6d1ef90 100644 --- a/JavaScript Pairs Game/script.js +++ b/JavaScript Pairs Game/script.js @@ -6,12 +6,13 @@ var seconds = 00; var tens = 00; var appendTens = document.getElementById("tens"); var appendSeconds = document.getElementById("seconds"); -var Interval; +var Interval = null; var images = ["sass", "git", "gulp", "css", "grunt"]; var clone = images.slice(0); // duplicate array var cards = images.concat(clone); // merge to arrays +document.getElementById("restartButton").disabled = true; // Shufffel function function shuffle(o) { for ( @@ -29,15 +30,15 @@ for (var i = 0; i < cards.length; i++) { card.dataset.view = "card"; myCards.appendChild(card); - card.onclick = function () { - if (this.className != "flipped" && this.className != "correct") { + card.onclick = function (){ + if (this.className != "flipped" && this.className != "correct" && Interval) { this.className = "flipped"; var result = this.dataset.item; resultsArray.push(result); clearInterval(Interval); Interval = setInterval(startTimer, 10); } - + if (resultsArray.length > 1) { if (resultsArray[0] === resultsArray[1]) { check("correct"); @@ -63,11 +64,25 @@ var check = function (className) { var win = function () { if (counter === 5) { - clearInterval(Interval); - text.innerHTML = "Your time was " + seconds + ":" + tens; + clearInterval(Interval); + text.innerHTML = "You Won!!"+"
    "+"Your time was " + seconds + ":" + tens; + document.getElementById("restartButton").disabled = false; } }; + +function RestartButton() +{ + +location.reload(); + +} + +function StartButton() +{ + Interval = setInterval(startTimer, 10); +} + function startTimer() { tens++; diff --git a/JavaScript Pairs Game/styles.css b/JavaScript Pairs Game/styles.css index e59f46f..c45d801 100644 --- a/JavaScript Pairs Game/styles.css +++ b/JavaScript Pairs Game/styles.css @@ -55,6 +55,7 @@ body { width: 630px; margin: 10px auto; } + #container:after { content: ""; display: table; diff --git a/Leap Year Generator/icon.jpg b/Leap Year Generator/icon.jpg new file mode 100644 index 0000000..e6123e6 Binary files /dev/null and b/Leap Year Generator/icon.jpg differ diff --git a/Leap Year Generator/index.html b/Leap Year Generator/index.html new file mode 100644 index 0000000..c09d97a --- /dev/null +++ b/Leap Year Generator/index.html @@ -0,0 +1,22 @@ + + + + + + Leap Year Generator + + + + +
    +

    Leap Year Generator

    + +
    + +
    + +
    +
    + + + \ No newline at end of file diff --git a/Leap Year Generator/script.js b/Leap Year Generator/script.js new file mode 100644 index 0000000..98d2914 --- /dev/null +++ b/Leap Year Generator/script.js @@ -0,0 +1,19 @@ +function generateLeapYears() +{ + const startYear = parseInt(document.getElementById("startYear").value); + const endYear = parseInt(document.getElementById("endYear").value); + let leapYears = []; + + for(let year = startYear; year <= endYear; year++) + { + if((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) + { + leapYears.push(year); + } + } + + const resultDiv = document.getElementById("result"); + + if(leapYears.length === 0) resultDiv.innerHTML = "No leap years in the range exist!"; + else resultDiv.innerHTML = "Leap years in the range: " + leapYears.join(", "); +} \ No newline at end of file diff --git a/Leap Year Generator/style.css b/Leap Year Generator/style.css new file mode 100644 index 0000000..818d6f3 --- /dev/null +++ b/Leap Year Generator/style.css @@ -0,0 +1,74 @@ +body +{ + font-family: Arial, sans-serif; + text-align: center; + background: linear-gradient(45deg, #007BFF, #00BFFF); + background-size: cover; + background-attachment: fixed; + color: #fff; +} + +h1 +{ + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + color: #007BFF; + margin-bottom: 20px; +} + +.container +{ + max-width: 400px; + margin: 0 auto; + padding: 20px; + background-color: #ffffff; + border-radius: 8px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); +} + +input[type = "number"] { + width: calc(100% - 20px); + padding: 10px; + margin: 5px 0; + border: none; + border-radius: 4px; + box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1); + transition: box-shadow 0.3s ease-in-out; +} + +input[type = "number"]:focus +{ + outline: none; + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); + border: 2px solid #007BFF; +} + +button +{ + background-color: #007BFF; + color: white; + border: none; + padding: 10px 20px; + margin-top: 10px; + border-radius: 4px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); + cursor: pointer; + transition: box-shadow 0.3s ease-in-out; +} + +button:hover +{ + transform: scale(1.05); +} + +.transition +{ + transition: all 0.3s ease; +} + +#result +{ + margin-top: 20px; + background-color: #007BFF; + padding: 10px; + border-radius: 4px; +} \ No newline at end of file diff --git a/Live User Filter/index.html b/Live User Filter/index.html new file mode 100644 index 0000000..210bbce --- /dev/null +++ b/Live User Filter/index.html @@ -0,0 +1,25 @@ + + + + + + + + Live User Filter + + +
    +
    +

    Live User Filter

    + Search By Name and/or Location: + +
    +
      +
    • +

      Loading...

      +
    • +
    +
    + + + \ No newline at end of file diff --git a/Live User Filter/script.js b/Live User Filter/script.js new file mode 100644 index 0000000..e89871f --- /dev/null +++ b/Live User Filter/script.js @@ -0,0 +1,53 @@ +/* +we are going to use +https://randomuser.me/api/ +this returns though oonly 1 user by default hence we use query field +https://randomuser.me/api/?results=20 for 20 users +*/ + +const result = document.getElementById('result') +const filter = document.getElementById('filter') +const listItems = [] + +getData() + +filter.addEventListener('input', (e) => filterData(e.target.value)) + +//function to get data +async function getData() { + + const res = await fetch('https://randomuser.me/api?results=500') + + const { results } = await res.json() + //we need data.results + + result.innerHTML = '' //removes the text loading + + results.forEach(user => { + const li = document.createElement('li') + listItems.push(li) + li.innerHTML = ` + ${user.name.first} +
    +

    ${user.name.first} ${user.name.last}

    +

    ${user.location.city}, ${user.location.country}

    +
    + ` + result.appendChild(li) + }) +} + +//function to filter data +function filterData(typed){ + listItems.forEach(item =>{ + a= item.innerText.toLowerCase() + b= typed.toLowerCase() + if(a.includes(b)){ + item.classList.remove('hide') + } + else + { + item.classList.add('hide') + } + }) +} diff --git a/Live User Filter/style.css b/Live User Filter/style.css new file mode 100644 index 0000000..dc8e53f --- /dev/null +++ b/Live User Filter/style.css @@ -0,0 +1,97 @@ +@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap'); + +*{ + box-sizing: border-box; +} + +body{ + background-color: #f1f9fd; + font-family: 'Roboto', sans-serif; + display: flex; + align-items: center; + justify-content: center; + height: 100vh; + overflow: hidden; + margin: 0; +} + +.container{ + border-radius: 5px; + box-shadow: 3px 3px 10px rgba(0,0,0,0.3); + overflow: hidden; + width: 300px; + font-weight: bolder; +} + +.title{ + margin: 0; +} + +.subtitle{ + display: inline-block; + margin: 2px 0px 20px; + opacity: 0.8; +} + +.header{ + background-color: #3e57db; + color: white; + padding: 30px 20px; +} + +.header input{ + background-color: rgba(0,0,0,0.3); + border: 0; + border-radius: 50px; + color: white; + font-size: 14px; + padding: 10px 15px; + width: 100%; +} + +.header input:focus{ + outline: none; +} + +.userlist{ + background-color: white; + list-style-type: none; + margin: 0; + max-height: 400px; + overflow-y: auto; /*for scroll bar since max-height 400px*/ + padding: 0; +} + +.userlist li{ + display: flex; + padding: 20px; +} + +.userlist img{ + border-radius: 50%; + object-fit: cover; + height: 50px; + width: 50px; +} + +.userlist .userinfo{ + margin-left: 10px; +} + +.userlist .userinfo h4{ + margin: 0 0 10px; +} + +.userlist .userinfo p{ + font-size: 12px; +} + +/* we want border bottom on every li except last*/ +.userlist li:not(:last-of-type){ + border-bottom: 1px solid #eee; +} + +/*this class will remove the element*/ +.userlist li.hide{ + display: none; +} \ No newline at end of file diff --git a/Note Taker/index.html b/Note Taker/index.html new file mode 100644 index 0000000..5c63372 --- /dev/null +++ b/Note Taker/index.html @@ -0,0 +1,23 @@ + + + + + + Note Taking App + + + + +
    +

    Note Taking App

    +
    + + + +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/Note Taker/note_icon.png b/Note Taker/note_icon.png new file mode 100644 index 0000000..e2afe48 Binary files /dev/null and b/Note Taker/note_icon.png differ diff --git a/Note Taker/script.js b/Note Taker/script.js new file mode 100644 index 0000000..bdb74b2 --- /dev/null +++ b/Note Taker/script.js @@ -0,0 +1,43 @@ +function addNote() +{ + const title = document.getElementById("noteTitle").value; + const content = document.getElementById("noteContent").value; + + if (title.trim().length === 0 || content.trim().length === 0) + { + alert("Please fill in both title and content fields."); + return; + } + + const noteList = document.getElementById("noteList"); + + const noteDiv = document.createElement("div"); + noteDiv.className = "note"; + + const noteTitle = document.createElement("h2"); + noteTitle.textContent = title; + + const noteContent = document.createElement("p"); + noteContent.textContent = content; + + const noteActions = document.createElement("div"); + noteActions.className = "note-actions"; + + const deleteButton = document.createElement("button"); + deleteButton.className = "delete-button"; + deleteButton.textContent = "Delete"; + deleteButton.onclick = function() + { + noteList.removeChild(noteDiv); + }; + + noteActions.appendChild(deleteButton); + noteDiv.appendChild(noteTitle); + noteDiv.appendChild(noteContent); + noteDiv.appendChild(noteActions); + + noteList.appendChild(noteDiv); + + document.getElementById("noteTitle").value = ""; + document.getElementById("noteContent").value = ""; +} \ No newline at end of file diff --git a/Note Taker/style.css b/Note Taker/style.css new file mode 100644 index 0000000..3b3fb4f --- /dev/null +++ b/Note Taker/style.css @@ -0,0 +1,122 @@ +body +{ + font-family: Arial, sans-serif; + text-align: center; + background: linear-gradient(45deg, #007BFF, #00BFFF); + background-size: cover; + background-attachment: fixed; + color: #fff; +} + +h1 +{ + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + color: #007BFF; + margin-bottom: 20px; +} + +.container +{ + max-width: 800px; + margin: 0 auto; + padding: 20px; + background-color: #ffffff; + border-radius: 8px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); + text-align: center; +} + +.note-form +{ + margin-bottom: 20px; +} + +input[type = "text"], +textarea +{ + width: 95%; + padding: 10px; + margin: 5px 0; + border: none; + border-radius: 4px; + box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1); + transition: box-shadow 0.3s ease-in-out; +} + +input[type = "text"]:focus, +textarea:focus +{ + outline: none; + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); + border: 2px solid #007BFF; +} + +button +{ + background-color: #007BFF; + color: white; + border: none; + padding: 10px 20px; + margin-top: 10px; + border-radius: 4px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); + cursor: pointer; + transition: transform 0.3s ease, background-color 0.3s ease; +} + +button:hover +{ + transform: scale(1.05); + background-color: #0056b3; +} + +.note-list +{ + text-align: center; +} + +.note +{ + background-color: lightcyan; + padding: 10px; + margin: 10px 0; + border-radius: 4px; + box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1); + display: flex; + flex-direction: column; + align-items: center; +} + +.note h2, +.note p +{ + color: #333; +} + +.note-actions +{ + display: flex; + gap: 10px; +} + +.note:hover +{ + box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.2); +} + +.delete-button +{ + background-color: #ff4f42; + color: white; + border: none; + padding: 5px 10px; + border-radius: 4px; + cursor: pointer; + transition: transform 0.3s ease, background-color 0.3s ease; +} + +.delete-button:hover +{ + transform: scale(1.1); + background-color: #ff1a12; +} \ No newline at end of file diff --git a/Pomodoro Timer/break.mp3 b/Pomodoro Timer/break.mp3 new file mode 100644 index 0000000..53c2713 Binary files /dev/null and b/Pomodoro Timer/break.mp3 differ diff --git a/Pomodoro Timer/index.html b/Pomodoro Timer/index.html new file mode 100644 index 0000000..e5ba7e6 --- /dev/null +++ b/Pomodoro Timer/index.html @@ -0,0 +1,30 @@ + + + + + + + Pomodoro Timer + + + +
    +

    Pomodoro Timer

    +
    +
    25:00
    +
    + + +
    +
    +
    + + + + +
    +
    + + + + \ No newline at end of file diff --git a/Pomodoro Timer/pomodoro_icon.png b/Pomodoro Timer/pomodoro_icon.png new file mode 100644 index 0000000..4248b4c Binary files /dev/null and b/Pomodoro Timer/pomodoro_icon.png differ diff --git a/Pomodoro Timer/script.js b/Pomodoro Timer/script.js new file mode 100644 index 0000000..91df442 --- /dev/null +++ b/Pomodoro Timer/script.js @@ -0,0 +1,109 @@ +class PomodoroTimer +{ + constructor(workDuration, breakDuration) + { + this.workDuration = workDuration * 60; + this.breakDuration = breakDuration * 60; + this.timer = null; + this.isWorking = true; + this.workAudio = new Audio("work.mp3"); + this.breakAudio = new Audio("break.mp3"); + this.workAudio.loop = true; + this.breakAudio.loop = true; + } + + startTimer() + { + this.timer = setInterval(() => + { + this.updateTimer(); + }, 1000); + + if(this.isWorking) + { + this.workAudio.play(); + this.breakAudio.pause(); + } + else + { + this.breakAudio.play(); + this.workAudio.pause(); + } + } + + stopTimer() + { + clearInterval(this.timer); + this.workAudio.pause(); + this.breakAudio.pause(); + } + + updateTimer() + { + const timeDisplay = document.getElementById("time-display"); + + if(this.isWorking) + { + this.workDuration--; + } + else + { + this.breakDuration--; + } + + if(this.workDuration === 0 && this.isWorking) + { + this.stopTimer(); + this.isWorking = false; + alert("Time for a break!"); + this.startTimer(); + } + else if(this.breakDuration === 0 && !this.isWorking) + { + this.stopTimer(); + this.isWorking = true; + alert("Back to work!"); + this.startTimer(); + } + + const minutes = Math.floor(this.isWorking ? this.workDuration / 60 : this.breakDuration / 60); + const seconds = this.isWorking ? this.workDuration % 60 : this.breakDuration % 60; + + const displayMinutes = minutes < 10 ? "0" + minutes : minutes; + const displaySeconds = seconds < 10 ? "0" + seconds : seconds; + + timeDisplay.innerText = `${displayMinutes}:${displaySeconds}`; + } + + resetTimer() + { + this.stopTimer(); + this.workDuration = document.getElementById("work-duration").value * 60; + this.breakDuration = document.getElementById("break-duration").value * 60; + this.isWorking = true; + const timeDisplay = document.getElementById("time-display"); + const displayMinutes = this.workDuration < 10 ? "0" + this.workDuration : this.workDuration; + timeDisplay.innerText = `${displayMinutes}:00`; + } +} + + const startButton = document.getElementById("start-button"); + const resetButton = document.getElementById("reset-button"); + const timer = new PomodoroTimer( + document.getElementById("work-duration").value, + document.getElementById("break-duration").value + ); + + startButton.addEventListener("click", () => + { + timer.startTimer(); + startButton.disabled = true; + resetButton.disabled = false; + }); + + resetButton.addEventListener("click", () => + { + timer.resetTimer(); + startButton.disabled = false; + resetButton.disabled = true; + }); \ No newline at end of file diff --git a/Pomodoro Timer/style.css b/Pomodoro Timer/style.css new file mode 100644 index 0000000..d06d5c8 --- /dev/null +++ b/Pomodoro Timer/style.css @@ -0,0 +1,111 @@ +body +{ + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; + background: linear-gradient(45deg, #007BFF, #00BFFF); +} + +.container +{ + width: 80%; + height: 45vh; + max-width: 600px; + padding: 20px; + background-color: #ffffff; + border-radius: 8px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); +} + +h1 +{ + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + color: #007BFF; + margin-bottom: 20px; + cursor: pointer; + transition: color 0.3s ease; +} + +h1:hover +{ + color: #0056b3; +} + +.timer +{ + font-size: 36px; + margin-bottom: 20px; +} + +#time-display +{ + font-weight: bold; +} + +#timer-buttons +{ + margin-top: 10px; +} + +button +{ + background-color: #007BFF; + color: white; + border: none; + padding: 10px 20px; + margin-top: 10px; + border-radius: 4px; + box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1), 0px 0px 20px rgba(0, 0, 0, 0.2); + cursor: pointer; + transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease; +} + +button:hover +{ + transform: scale(1.05); + background-color: #0056b3; + box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.2), 0px 0px 20px rgba(0, 0, 0, 0.4); +} + +.settings +{ + text-align: left; + margin-top: 20px; +} + +label +{ + display: block; + margin-bottom: 5px; + font-weight: bold; +} + +input[type = "number"] +{ + width: 96%; + padding: 10px; + margin-bottom: 10px; + border: 1px solid #ccc; + border-radius: 4px; +} + +input[type = "text"], +textarea +{ + width: 95%; + padding: 10px; + margin: 5px 0; + border: none; + border-radius: 4px; + box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1), 0px 0px 20px rgba(0, 0, 0, 0.2); + transition: box-shadow 0.3s ease-in-out; +} + +input[type = "text"]:focus, +textarea:focus +{ + outline: none; + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2), 0px 0px 20px rgba(0, 0, 0, 0.4); +} \ No newline at end of file diff --git a/Pomodoro Timer/work.mp3 b/Pomodoro Timer/work.mp3 new file mode 100644 index 0000000..1fac3a7 Binary files /dev/null and b/Pomodoro Timer/work.mp3 differ diff --git a/QUIZ--APP/css/custom.css b/QUIZ--APP/css/custom.css new file mode 100644 index 0000000..14cdf7f --- /dev/null +++ b/QUIZ--APP/css/custom.css @@ -0,0 +1,55 @@ +* { + padding: 0; + margin: 0; + box-sizing: border-box; + font-family: 'Poppins', sans-serif; +} + +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100&display=swap'); + +.main { + width: 100%; + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + background-color: rgb(24, 128, 207); +} + +.container { + width: 35rem; + box-shadow: 0px 0px 5px grey; + display: flex; + background-color: white; + border-radius: 10px; + overflow: hidden; + flex-direction: column; +} + +.col { + text-align: justify; + padding: 15px; + width: 95%; +} + +#submit { + width: 100%; + background-color: rgb(47, 8, 73); + transition: 0.5s; + color: white; + outline: none; + border: none; + font-size: 25px; + display: block; + padding: 10px; + cursor: pointer; +} + +#submit:hover { + background-color: rgb(34, 6, 53); +} + +.box { + box-shadow: 0px -1px 1px grey; + width: 100%; +} \ No newline at end of file diff --git a/QUIZ--APP/index.html b/QUIZ--APP/index.html new file mode 100644 index 0000000..4d2e973 --- /dev/null +++ b/QUIZ--APP/index.html @@ -0,0 +1,44 @@ + + + + + + + + Document + + + + +
    + +
    +
    +

    + 1) Lorem ipsum dolor sit amet, consectetur adipisicing elit Debitis? +

    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    + +
    + +
    + + + + \ No newline at end of file diff --git a/QUIZ--APP/js/app.js b/QUIZ--APP/js/app.js new file mode 100644 index 0000000..45d58f3 --- /dev/null +++ b/QUIZ--APP/js/app.js @@ -0,0 +1,96 @@ +const quizData = [{ + question: "Which of the following is a client site language?", + a: "Java", + b: "C", + c: "Python", + d: "JavaScript", + correct: "d", +}, +{ + question: "What does HTML stand for?", + a: "Hypertext Markup Language", + b: "Cascading Style Sheet", + c: "Jason Object Notation", + d: "Helicopters Terminals Motorboats Lamborginis", + correct: "a", +}, +{ + question: "What year was JavaScript launched?", + a: "1996", + b: "1995", + c: "1994", + d: "none of the above", + correct: "b", +}, +{ + question: "What does CSS stands for?", + a: "Hypertext Markup Language", + b: "Cascading Style Sheet", + c: "Jason Object Notation", + d: "Helicopters Terminals Motorboats Lamborginis", + correct: "b", +} +]; +let index = 0; +let correct = 0, + incorrect = 0, + total = quizData.length; +let questionBox = document.getElementById("questionBox"); +let allInputs = document.querySelectorAll("input[type='radio']") +const loadQuestion = () => { + if (total === index) { + return quizEnd() + } + reset() + const data = quizData[index] + questionBox.innerHTML = `${index + 1}) ${data.question}` + allInputs[0].nextElementSibling.innerText = data.a + allInputs[1].nextElementSibling.innerText = data.b + allInputs[2].nextElementSibling.innerText = data.c + allInputs[3].nextElementSibling.innerText = data.d +} + +document.querySelector("#submit").addEventListener( + "click", + function () { + const data = quizData[index] + const ans = getAnswer() + if (ans === data.correct) { + correct++; + } else { + incorrect++; + } + index++; + loadQuestion() + } +) + +const getAnswer = () => { + let ans; + allInputs.forEach( + (inputEl) => { + if (inputEl.checked) { + ans = inputEl.value; + } + } + ) + return ans; +} + +const reset = () => { + allInputs.forEach( + (inputEl) => { + inputEl.checked = false; + } + ) +} + +const quizEnd = () => { + // console.log(document.getElementsByClassName("container")); + document.getElementsByClassName("container")[0].innerHTML = ` +
    +

    Hii, you've scored ${correct} / ${total}

    +
    +` +} +loadQuestion(index); diff --git a/Quote Generator/css/style.css b/Quote Generator/css/style.css index ca49591..b15b65d 100644 --- a/Quote Generator/css/style.css +++ b/Quote Generator/css/style.css @@ -75,27 +75,90 @@ button:active { transform: scale(1.2); } -.back1 { - background-color: aqua; - color: blueviolet; +.back1 { + position: fixed; + width: 100%; + height: 100%; + background: #9e0142; + animation: color 15s infinite linear; + text-align: center; + z-index: -1; + color: black; } -.back2 { - background-color: rgb(254, 39, 39); - color: rgb(6, 6, 6); +@keyframes color { + 0% { background: #9e0142; } + 10% { background: #d53e4f; } + 20% { background: #f46d43; } + 30% { background: #e38c36; } + 40% { background: #ecb622; } + 50% { background: #5ac60d; } + 60% { background: #17a504; } + 70% { background: #66c2a5; } + 80% { background: #3288bd; } + 90% { background: #5e4fa2; } + 100% { background: #36c452; } } -.back3 { - background-color: rgb(39, 182, 254); - color: rgb(237, 254, 5); +.glow-on-hover { + width: 220px; + height: 50px; + border: none; + outline: none; + color:whitesmoke; + background: #007bff;; + cursor: pointer; + position: relative; + z-index: 0; + border-radius: 1rem; +} + +.glow-on-hover:before { + content: ''; + background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000); + position: absolute; + top: -2px; + left:-2px; + background-size: 400%; + z-index: -1; + filter: blur(5px); + width: calc(100% + 4px); + height: calc(100% + 4px); + animation: glowing 20s linear infinite; + opacity: 0; + transition: opacity .3s ease-in-out; + border-radius: 0.5rem; } -.back4 { - background-color: rgb(8, 253, 114); - color: rgb(10, 10, 10); +.glow-on-hover:active { + color:whitesmoke; } +.glow-on-hover:active:after { + background: transparent; +} + +.glow-on-hover:hover:before { + opacity: 1; +} +.glow-on-hover:after { + z-index: -1; + content: ''; + position: absolute; + width: 100%; + height: 100%; + background:#007bff;; + left: 0; + top: 0; + border-radius: 10px; +} + +@keyframes glowing { + 0% { background-position: 0 0; } + 50% { background-position: 400% 0; } + 100% { background-position: 0 0; } +} /* /loader/ */ @@ -103,7 +166,7 @@ button:active { position: fixed; width: 100%; height: 100%; - background: rgba(23, 23, 23, 0.945); + background: rgba(255, 255, 255, 0.4); display: flex; justify-content: center; align-items: center; diff --git a/Quote Generator/js/script.js b/Quote Generator/js/script.js index 6fee0d0..6e0cd05 100644 --- a/Quote Generator/js/script.js +++ b/Quote Generator/js/script.js @@ -1,4 +1,4 @@ -const quote = document.querySelector('.quote'); +const quote = document.querySelector(".quote"); // function quote() { // fetch('https://api.quotable.io/random') @@ -14,38 +14,33 @@ const quote = document.querySelector('.quote'); // } // JavaScript code to show/hide the loader function showLoader() { - document.querySelector('.loader-wrapper').style.display = 'flex'; + document.querySelector(".loader-wrapper").style.display = "flex"; } function hideLoader() { - document.querySelector('.loader-wrapper').style.display = 'none'; + document.querySelector(".loader-wrapper").style.display = "none"; } // Example usage: Call showLoader() before an asynchronous task, and hideLoader() after the task is completed. -const body = document.querySelector('.main'); -const arr = ["back1", "back2", "back3", "back4", "back1"] +const body = document.querySelector(".main"); +const arr = ["back1", "back1", "back1", "back1", "back1"]; let prev = 0; body.classList.add(arr[prev]); async function quotes() { - showLoader() - body.classList.remove(arr[prev]); - body.classList.add(arr[prev + 1]); - if (prev < 3) { - prev++; - - } - else { - prev = 0; - } - let quotes = await fetch("https://api.quotable.io/random") - let data = await quotes.json(); - -quote.innerHTML = data.content; -hideLoader() + showLoader(); + body.classList.remove(arr[prev]); + body.classList.add(arr[prev + 1]); + if (prev < 3) { + prev++; + } else { + prev = 0; + } + let quotes = await fetch("https://api.quotable.io/random"); + let data = await quotes.json(); + + quote.innerHTML = data.content; + hideLoader(); } quotes(); - - - diff --git a/Quote Generator/quote_generator.html b/Quote Generator/quote_generator.html index b12ec8a..95834e0 100644 --- a/Quote Generator/quote_generator.html +++ b/Quote Generator/quote_generator.html @@ -17,7 +17,7 @@
    - + diff --git a/Random Password Generator/css/style.css b/Random Password Generator/css/style.css index 35fa333..031cfe0 100644 --- a/Random Password Generator/css/style.css +++ b/Random Password Generator/css/style.css @@ -1,59 +1,103 @@ body { - font-family: Arial, sans-serif; - background-color: #f4f4f4; + font-family: 'Arial', sans-serif; + background-color: #f5f5f5; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; } .container { - max-width: 400px; - margin: 0 auto; text-align: center; background-color: #fff; - padding: 20px; - border-radius: 5px; - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2); + padding: 40px; + border-radius: 10px; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); } h1 { - color: #333; + color: #37517e; + margin-bottom: 20px; + font-size: 36px; } .options { - text-align: left; + margin-bottom: 30px; } -input[type="number"] { - width: 100%; - padding: 10px; - margin-bottom: 10px; +label, input, button { + margin-bottom: 15px; font-size: 16px; } -input[type="checkbox"] { - margin-right: 5px; +input[type="number"] { + width: 60px; + text-align: center; } button { - padding: 10px 16px; - font-size: 16px; - background-color: #333; + cursor: pointer; + transition: background-color 0.3s ease; + padding: 15px 30px; + background-color: #47b2e4; color: white; border: none; - cursor: pointer; + border-radius: 5px; +} + +#generatePassword +{ + margin-bottom: 0; +} +button:hover { + background-color: #37517e; } .password { - margin-top: 20px; + margin-top: 30px; } -input[type="text"] { - width: 100%; - padding: 10px; - font-size: 18px; - border: 1px solid #ccc; +#password { + margin-bottom: 20px; + padding: 15px; + font-size: 20px; + border: 2px solid #37517e; border-radius: 5px; + background-color: #f9f9f9; + color: #37517e; } #copyToClipboard { - margin-top: 10px; - background-color: #f1a33c; + background-color: #47b2e4; + color: white; + border: none; + padding: 15px 30px; + cursor: pointer; + transition: background-color 0.3s ease; + border-radius: 5px; +} + +#copyToClipboard:hover { + background-color: #37517e; +} + +/* Responsive styles */ +@media (max-width: 768px) { + .container { + padding: 20px; + } + + h1 { + font-size: 28px; + } + + input[type="number"] { + width: 40px; + } + + button { + font-size: 14px; + padding: 12px 24px; + } } diff --git a/Random Password Generator/index.html b/Random Password Generator/index.html index 491acb0..07146f0 100644 --- a/Random Password Generator/index.html +++ b/Random Password Generator/index.html @@ -3,7 +3,7 @@ - + Strong Password Generator @@ -28,10 +28,10 @@

    Strong Password Generator

    - +
    - + diff --git a/Random Password Generator/js/script.js b/Random Password Generator/js/script.js index 062b401..5aff016 100644 --- a/Random Password Generator/js/script.js +++ b/Random Password Generator/js/script.js @@ -12,6 +12,10 @@ document.addEventListener("DOMContentLoaded", function () { function generatePassword() { const length = parseInt(passwordLengthInput.value); + if(!length) { + alert("Please enter a valid password length."); + return; + } const includeUppercase = includeUppercaseCheckbox.checked; const includeLowercase = includeLowercaseCheckbox.checked; const includeNumbers = includeNumbersCheckbox.checked; diff --git a/Rock Paper/index.html b/Rock Paper/index.html new file mode 100644 index 0000000..351201e --- /dev/null +++ b/Rock Paper/index.html @@ -0,0 +1,14 @@ + + + + + + + Rock Paper + + + + + + + \ No newline at end of file diff --git a/Rock Paper/script.js b/Rock Paper/script.js new file mode 100644 index 0000000..915aa42 --- /dev/null +++ b/Rock Paper/script.js @@ -0,0 +1,56 @@ +var userChoice = prompt("Do you choose rock, paper or scissors?"); + +var computerChoice = Math.random(); +if (computerChoice < 0.34) { + computerChoice = "rock"; +} else if (computerChoice <= 0.67) { + computerChoice = "paper"; +} else { + computerChoice = "scissors"; +} +//console.log("Computer chooses: " + computerChoice); + +var compare = function (choice1, choice2) { + + if (choice1 === choice2) { + + return "The result is a tie!" + " " + "Lets play again."; + } + + else if (choice1 === "rock") { + + if (choice2 === "scissors") { + return "rock wins" + "
    " + "You beat the computer, nice job!"; + } + else { + return "paper wins" + "
    " + "Your really smart computer beat you."; + } + } + + else if (choice1 === "paper") { + + if (choice2 === "rock") { + return "paper wins" + "
    " + "You beat the computer, nice job!"; + } + else { + return "scissors wins" + "
    " + "Your really smart computer beat you."; + } + + } + + else if (choice1 === "scissors") { + + if (choice2 === "rock") { + return "rock wins" + "
    " + "Your really smart computer beat you."; + } + else { + return "scissors win" + "
    " + "You beat the computer, nice job!"; + } + } + + +} //closes compare function + + +document.write("Computer chose: " + computerChoice + "
    "); +document.write(compare(userChoice, computerChoice)); diff --git a/SaveMan/fun.js b/SaveMan/fun.js new file mode 100644 index 0000000..0c8c606 --- /dev/null +++ b/SaveMan/fun.js @@ -0,0 +1,215 @@ +console.log("hi") +var word = [["Save", "That game you are playing right now."], ["HTML", "Markup language for creating Web pages."], ["CSS", "Wep page styles"], ["PHP", "A very popular server scripting language."], ["JavaScript", "Make web-page dynamic without reload the web page."], ["Java", "Run 15 billion devices.\nA program can be run in Windows, Linux and Mac"], ["SoloLearn", "A company that everyone can code for fun and share."], ["Love", "What is ?\nBaby don't hurt me\nDon't hurt me\nNo more"], ["Document", "A lot of text in the a file."], ["Playground", "There school kids go to."], ["Run", "Usain bolt."], ["Code", "var hw = 'Hello World';"], ["Samsung", "A company create Phone, Tv, Monitor, SDD, Memory chip..."], ["Super Mario", "A very popular game in Nintendo 64 that have red hat."], ["Star", "Super Mario like to get."], ["Clock", "14:12 or 14pm"], ["Binary Clock", "A clock that only use 0 or 1."], ["Sword", "Link from Zelda have on the hand."], ["Girl", "Not boy but ?"], ["Boy", "Not girl but ?"], ["Female", "Other name as girl."], ["Male", "Other name as boy."], ["Smartphone", "Something you've always on you."]] + +// Game keyboard +var tastatur = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// Game memory +var select = 0 +var wordLeft = [] +var fail = 0 + +// Web-page onload +window.onload = function() { + gId("moveKeybord").addEventListener('touchmove', function(e) { + wH = window.innerHeight + tY = e.touches[0].clientY + eL = gId("tastatur") + resY = wH - tY - eL.offsetHeight + if(resY < 0) { + resY = 0 + } else if(resY > wH / 2) { + resY = wH / 2 + } + eL.style.bottom = resY + "px" }, false) + createTastur() +} + +// Start game +function startGame() { + gId("home").className = "h" + gId("result").className = "h" + newGame() +} + +// New game +function newGame() { + clearTastatur() + clearPlayer() + createWord() +} + +// Clear keyboard +function clearTastatur() { + var e = document.getElementsByClassName("b") + for(a = 0; a < e.length; a++) { + e[a].setAttribute("data", "") + } +} + +// Clear player +function clearPlayer() { + fail = 0 + wordLeft = [] + gId("g0").setAttribute("data", "false") + gId("g1").setAttribute("data", "false") + gId("g2").setAttribute("data", "false") + gId("g3").setAttribute("data", "false") + gId("g4").setAttribute("data", "false") + gId("g5").setAttribute("data", "false") + gId("g5").setAttribute("r", "false") + gId("g5").setAttribute("l", "false") + gId("g6").setAttribute("data", "false") + gId("g6").setAttribute("l", "false") + gId("g6").setAttribute("r", "false") + gId("hintButton").setAttribute("data", "false") + gId("hint").style.display = "none" +} + +// Get new word +function createWord() { + var d = gId("letter") + d.innerHTML = "" + select = Math.floor(Math.random() * word.length) + for(a = 0; a < word[select][0].length; a++) { + var x = word[select][0][a].toUpperCase() + var b = document.createElement("span") + b.className = "l" + (x == " " ? " ls" : "") + b.innerHTML = " " + b.id = "l" + a; + d.appendChild(b) + + if(x != " ") { + if(wordLeft.indexOf(x) == -1) { + wordLeft.push(x) + } + } + } +} + +// Create keyboard +function createTastur() { + var tas = gId("keybord") + tas.innerHTML = "" + for(a = 0; a < tastatur.length; a++) { + var b = document.createElement("span") + b.className = "b" + b.innerText = tastatur[a] + b.setAttribute("data", "") + b.onclick = function() { + bTas(this) + } + tas.appendChild(b) + } +} + +// Game check, If show next error / game end +function bTas(a) { + if(a.getAttribute("data") == "") { + var x = isExist(a.innerText) + a.setAttribute("data", x) + if(x) { + if(wordLeft.length == 0) { + gameEnd(true) + } + } else { + showNextFail() + } + } +} + +// If letter "X" exist +function isExist(e) { + e = e.toUpperCase() + var x = wordLeft.indexOf(e) + if(x != -1) { + wordLeft.splice(x, 1) + typeWord(e) + return true + } + return false +} + +// Show next fail drawing +function showNextFail() { + fail++ + switch(fail) { + case 1: + gId("g0").setAttribute("data", "true") + break; + + case 2: + gId("g1").setAttribute("data", "true") + break; + + case 3: + gId("g2").setAttribute("data", "true") + break; + + case 4: + gId("g3").setAttribute("data", "true") + gId("hintButton").setAttribute("data", "true") + break; + + case 5: + gId("g4").setAttribute("data", "true") + break; + + case 6: + gId("g5").setAttribute("data", "true") + break; + + case 7: + gId("g5").setAttribute("l", "true") + break; + + case 8: + gId("g5").setAttribute("r", "true") + break; + + case 9: + gId("g6").setAttribute("data", "true") + gId("g6").setAttribute("l", "true") + break; + + case 10: + gId("g6").setAttribute("r", "true") + gameEnd(false) + break; + } +} + +function typeWord(e) { + for(a = 0; a < word[select][0].length; a++) { + if(word[select][0][a].toUpperCase() == e) { + gId("l" + a).innerText = e + } + } +} + +// Game result +function gameEnd(e) { + var d = gId("result") + d.setAttribute("data", e) + if(e) { + gId("rT").innerText = "You Win!" + gId("rM").innerHTML = "Congratulations, you found the word!

    Good Job!" + } else { + gId("rT").innerText = "You Lose!" + gId("rM").innerHTML = "The word was

    \"" + word[select][0].toUpperCase() + "\"

    Better luck next time." + } + d.className = "" +} + +function hint() { + gId("hintText").innerText = word[select][1] + gId("hint").style.display = "block" +} + +function hintExit() { + gId("hint").style.display = "none" +} + +function gId(a) { + return document.getElementById(a) +} diff --git a/SaveMan/index.html b/SaveMan/index.html new file mode 100644 index 0000000..ca3be3c --- /dev/null +++ b/SaveMan/index.html @@ -0,0 +1,45 @@ + + + + Hangman (Game) + + + +
    +
    Save Man
    +
    Play
    + +
    +
    +
    +
    +
    Try Again?
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    ?
    +
    +
    +
    +
    +
    +
    +
    Hint
    X
    +
    +
    +
    + + + diff --git a/SaveMan/style.css b/SaveMan/style.css new file mode 100644 index 0000000..d8dc0dc --- /dev/null +++ b/SaveMan/style.css @@ -0,0 +1,458 @@ +body { + background-color: #eee; + margin: 0; +} + +#home { + background: linear-gradient(#eee, #aaa); + background: -webkit-linear-gradient(top, #eee, #aaa); + background: -ms-linear-gradient(top, #eee, #aaa); + background: -moz-linear-gradient(top, #eee, #aaa); + background: -o-linear-gradient(top, #eee, #aaa); + bottom: 0; + left: 0; + position: absolute; + right: 0; + top: 0; + z-index: 99; +} + +#home .title { + font-size: 48px; + font-weight: bold; + margin-top: 15%; + text-align: center; +} + +#home .button { + background: #afa; + background: linear-gradient(#afa, #6f6); + background: -webkit-linear-gradient(top, #afa, #6f6); + background: -ms-linear-gradient(top, #afa, #6f6); + background: -moz-linear-gradient(top, #afa, #6f6); + background: -o-linear-gradient(top, #afa, #6f6); + border-radius: 2px; + box-shadow: 0 0 0 5px #090; + display: table; + font-weight: bold; + padding: 10px 20px; + margin: 20% auto; +} + +#home .foother { + bottom: 20px; + font-size: 12px; + font-style: italic; + position: absolute; + right: 20px; +} + +.h { + display: none; +} + +#result { + background: #700; + background: linear-gradient(rgba(125, 0, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -webkit-linear-gradient(top, rgba(125, 0, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -ms-linear-gradient(top, rgba(125, 0, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -moz-linear-gradient(top, rgba(125, 0, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -o-linear-gradient(top, rgba(125, 0, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + bottom: 0; + left: 0; + position: absolute; + right: 0; + top: 0; + z-index: 100; +} + +#result[data="true"] { + background: #070; + background: linear-gradient(rgba(0, 125, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -webkit-linear-gradient(top, rgba(0, 125, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -ms-linear-gradient(top, rgba(0, 125, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -moz-linear-gradient(top, rgba(0, 125, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); + background: -o-linear-gradient(top, rgba(0, 125, 0, 0.9) 20%, rgba(0, 0, 0, 0.7) 80%); +} + +#result .title { + color: #eee; + font-size: 48px; + margin-top: 15%; + text-align: center; + text-shadow: 1px 1px 0 #000; +} + +#result .body { + color: #fff; + margin-top: 30px; + text-align: center; + text-shadow: 1px 1px 0 #000; +} + +#result .button { + background:#afa; + background: linear-gradient(#afa, #6f6); + background: -webkit-linear-gradient(top, #afa, #6f6); + background: -ms-linear-gradient(top, #afa, #6f6); + background: -moz-linear-gradient(top, #afa, #6f6); + background: -o-linear-gradient(top, #afa, #6f6); + border-radius: 2px; + box-shadow: 0 0 0 5px #090; + display: table; + font-weight: bold; + padding: 10px 20px; + margin: 40px auto; + margin-bottom: 0; +} + +#letter { + font-size: 22px; + height: 30px; + margin: 20px; + text-align: center; +} + +.l { + box-shadow: 0 3px 0 -1px #555; + display: inline-block; + margin: 1px; + height: 20px; + text-transform: uppercase; + width: 20px; +} + +.ls { + box-shadow: 0 0 0 0 #555; + width: 10px; +} + +#game { + height: 250px; + margin: auto; + position: relative; + width: 220px; +} + +#game .player { + left: 53px; + position: absolute; + top: 90px; + height: 130px; + width: 75px; +} + +.player .playerModel { + height: 100%; + position: relative; + width: 100%; +} + +.playerModel .head { + border-radius: 50%; + box-shadow: 0 0 0 2px #000 inset; + height: 35px; + margin: auto; + width: 35px; +} + +.playerModel .head[data="false"] { + display: none; +} + +.playerModel .body { + background-color: #000; + height: 45px; + margin: auto; + width: 2px; +} + +.playerModel .body[data="false"] { + display: none; +} + +.playerModel .body:before, .playerModel .body:after { + background-color: #000; + content: ""; + display: inline-block; + height: 30px; + position: absolute; + width: 2px; +} + +.playerModel .body[l="false"]:before, .playerModel .body[r="false"]:after { + display: none; +} + +.playerModel .body:before { + left: 27px; + transform: rotate(45deg); + -webkit-transform: rotate(45deg); +} + +.playerModel .body:after { + right: 26px; + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); +} + +.playerModel .foot { + background-color: #000; + height: 3px; + margin: auto; + width: 2px; +} + +.playerModel .foot[data="false"] { + display: none; +} + +.playerModel .foot:before, .playerModel .foot:after { + background-color: #000; + content: ""; + display: inline-block; + height: 40px; + position: absolute; + width: 2px; +} + +.playerModel .foot[l="false"]:before, .playerModel .foot[r="false"]:after { + display: none; +} + +.playerModel .foot:before { + left: 30px; + transform: rotate(20deg); + -webkit-transform: rotate(20deg); +} + +.playerModel .foot:after { + right: 29px; + transform: rotate(-20deg); + -webkit-transform: rotate(-20deg); +} + +#game .stang3 { + background-color: #000; + height: 20px; + left: 90px; + position: absolute; + top: 70px; + width: 2px; +} + +#game .stang3[data="false"] { + display: none; +} + +#game .stang2 { + background-color: #000; + border-radius: 5px 0 0 5px; + bottom: 180px; + height: 5px; + position: absolute; + right: 45px; + width: 95px; +} + +#game .stang2:before { + background-color: #000; + content: ""; + left: 50px; + height: 5px; + position: absolute; + top: 17px; + transform: rotate(45deg); + -webkit-transform: rotate(45deg); + width: 50px; +} + +#game .stang2[data="false"] { + display: none; +} + +#game .stang { + background-color: #000; + bottom: 0; + height: 180px; + margin: auto; + position: absolute; + right: 45px; + width: 5px; +} + +#game .stang[data="false"] { + display: none; +} + +#game .ground { + background-color: #000; + border-radius: 5px; + bottom: 0; + left: 0; + height: 5px; + margin: auto; + position: absolute; + right: 0; + width: 220px; +} + +#game .ground[data="false"] { + display: none; +} + +#game .hintButton { + background: #ccc; + background: linear-gradient(transparent, rgba(0, 0, 0, 0.1)); + background: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1)); + background: -ms-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1)); + background: -moz-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1)); + background: -o-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1)); + border-radius: 8%; + box-shadow: 1px 1px 3px #999; + font-weight: bold; + padding: 5px 10px; + position: absolute; + right: 5px; + top: 5px; +} + +#game .hintButton[data="false"] { + display: none; +} + +#tastatur { + background-color: rgba(238, 238, 238, 0.9); + bottom: 0; + left: 0; + margin: auto; + margin-bottom: 20px; + max-width: 500px; + padding: 0 15px; + position: absolute; + right: 0; + text-align: center; +} + +#moveKeybord { + padding: 15px; +} + +.marg { + border-bottom: solid 2px #ccc; +} + +#hint { + border-radius: 2px; + box-shadow: 1px 1px 4px #888; + display: none; + left: 0; + margin: auto; + margin-top: 75px; + position: absolute; + right: 0; + top: 0; + width: 250px; +} + +#hint .title { + background: #fff; + background: linear-gradient(#fff, #bbb); + background: -webkit-linear-gradient(top, #fff, #bbb); + background: -ms-linear-gradient(top, #fff, #bbb); + background: -moz-linear-gradient(top, #fff, #bbb); + background: -o-linear-gradient(top, #fff, #bbb); + border-bottom: solid 1px #555; + border-radius: 2px 2px 0 0; + font-weight: bold; + padding: 5px 10px; + position: relative; +} + +#hint .title .exit { + background-color: #f55; + border-radius: 50%; + box-shadow: 1px 1px 4px #888; + font-weight: bold; + padding: 8px 12px; + position: absolute; + right: -15px; + top: -15px; +} + +#hint .body { + background-color: #ddd; + border-radius: 0 0 2px 2px; + padding: 10px; +} + +.b { + background: #eee; + background: linear-gradient(#fff, #eee); + background: -webkit-linear-gradient(top, #fff, #eee); + background: -ms-linear-gradient(top, #fff, #eee); + background: -moz-linear-gradient(top, #fff, #eee); + background: -o-linear-gradient(top, #fff, #eee); + box-shadow: 1px 1px 1px 0 #ccc; + display: inline-block; + margin: 2px; + padding: 8px; + text-align: center; + width: 25px; +} + +.b[data="false"], .b[data="true"] { + color: #555; + font-weight: bold; +} + +.b[data="true"] { + background: #9f9; +} + +.b[data="false"] { + background: #aaa; +} + +.anim { + animation: button 3s infinite; + -webkit-animation: button 3s infinite; +} + +@keyframes button { + 0%, 50%, 90% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + } + 60% { + transform: rotate(5deg) scale(1); + -webkit-transform: rotate(5deg) scale(1); + } + 70% { + transform: rotate(-5deg) scale(0.97); + -webkit-transform: rotate(-5deg) scale(0.97); + } + 80% { + transform: rotate(5deg) scale(1.05); + -webkit-transform: rotate(5deg) scale(1.05); + } +} + +@-webkit-keyframes button { + 0%, 50%, 90% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + } + 60% { + transform: rotate(5deg) scale(1); + -webkit-transform: rotate(5deg) scale(1); + } + 70% { + transform: rotate(-5deg) scale(0.97); + -webkit-transform: rotate(-5deg) scale(0.97); + } + 80% { + transform: rotate(5deg) scale(1.05); + -webkit-transform: rotate(5deg) scale(1.05); + } +} diff --git a/Schulte Table/css/main.css b/Schulte Table/css/main.css new file mode 100644 index 0000000..4a931af --- /dev/null +++ b/Schulte Table/css/main.css @@ -0,0 +1,38 @@ +body{ + background: rgb(124,247,152); + background: radial-gradient(circle, rgba(124,247,152,0.865983893557423) 0%, rgba(147,251,225,0.9444152661064426) 100%); +} + +.grid{ + display: flex; + flex-wrap: wrap; + margin: auto; + background-color: aqua; + width: 300px; + height: 300px; +} + +.button{ + margin-bottom: 70px; +} + +footer { + color: #fff; + position: fixed; + bottom: 0px; + width: 100%; + height: 50px; + font-family: 'Noto Sans JP', sans-serif; +} + +footer a { + text-decoration: none; + color: inherit; + font-family: inherit; +} + +footer a:hover { + text-decoration: none; + color: #000; + font-family: inherit; +} diff --git a/Schulte Table/images/brain.ico b/Schulte Table/images/brain.ico new file mode 100644 index 0000000..3786012 Binary files /dev/null and b/Schulte Table/images/brain.ico differ diff --git a/Schulte Table/index.html b/Schulte Table/index.html new file mode 100644 index 0000000..119a947 --- /dev/null +++ b/Schulte Table/index.html @@ -0,0 +1,52 @@ + + + + + SCHULTE TABLE + + + + + + + + + +
    +

    SCHULTE TABLE

    +
    +
    +
    +
    Attemps: 0
    +
    +
    +
    Time: 0
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + + + + + \ No newline at end of file diff --git a/Schulte Table/js/script.js b/Schulte Table/js/script.js new file mode 100644 index 0000000..cd3644a --- /dev/null +++ b/Schulte Table/js/script.js @@ -0,0 +1,93 @@ +var numbers = [1,2,3,4,5,6,7,8,9]; +var current = 0; +var attemp = 0; +var time = 0; +var dimension = 9; +numbers = numbers.sort(()=>Math.random()-0.5); + +function drawTable(length, prop){ + const grid = document.querySelector('.grid'); + grid.innerHTML = ""; + for (let i = 0; i < length; i++) { + let cell = document.createElement('div'); + cell.setAttribute('id', numbers[i]); + cell.style.backgroundColor = "#1abc9c"; + cell.style.width = prop +"px"; + cell.style.height = prop +"px"; + cell.style.border = "1px solid #16a085"; + cell.style.cursor = "pointer"; + cell.style.textAlign = "center"; + cell.style.display = "table-cell"; + cell.style.verticalAlign = "middle"; + cell.addEventListener('click', selected); + + let label = document.createElement("h1"); + label.innerHTML = numbers[i]; + label.style.margin = "0px"; + label.style.position = "relative"; + label.style.top = "50%"; + label.style.transform = "translateY(-50%)"; + + cell.appendChild(label); + grid.appendChild(cell); + } +} + +function selected(){ + const id = this.getAttribute('id'); + attemp++; + document.querySelector("#attemp").innerHTML = "Attemps: " +attemp; + if(parseInt(id) == current+1){ + current++; + if(current == dimension){ + document.querySelector('.alert').hidden = false; + document.querySelector('.alert').innerHTML = "CONGRATULATIONS!!! YOU WIN IN " +attemp +" ATTEMPS AND " +time +" SECONDS"; + setTimeout(()=>{ + document.querySelector('.alert').hidden = true; + location.reload(); + }, 5000); + } + flashColor(this, "#4cd137"); + }else{ + flashColor(this, "#e74c3c"); + } +} + +function flashColor(element, color){ + element.style.backgroundColor = color; + setTimeout(() => { + element.style.backgroundColor = "#1abc9c"; + }, 100); +} + +function selectItem(){ + let option = document.getElementById('mySelect').value; + dimension = option*option; + numbers = []; + for (let i = 0; i < dimension; i++) { + numbers[i] = i+1; + } + numbers = numbers.sort(()=>Math.random()-0.5); + + let prop = (dimension>36)?80:100; + document.querySelector('.grid').style.width = "" +(option*prop) +"px"; + document.querySelector('.grid').style.height = "" +(option*prop) +"px"; + drawTable(dimension, prop); + resetValues(); +} + +function resetValues(){ + time = 0; + attemp = 0; + current = 0; + document.querySelector("#attemp").innerHTML = "Attemps: 0"; + document.querySelector('#time').innerHTML = "Time: 0s"; +} + +setInterval(()=>{ + document.querySelector('#time').innerHTML = "Time: " +time +"s"; + time++; +}, 1000); + +drawTable(9, 100); +document.getElementById('year').innerHTML = new Date().getFullYear(); \ No newline at end of file diff --git a/Timer/css/style.css b/Timer/css/style.css index 979b937..339d0a2 100644 --- a/Timer/css/style.css +++ b/Timer/css/style.css @@ -1,5 +1,3 @@ - - body { font-family: Arial, sans-serif; background-color: #3a3632; @@ -9,7 +7,6 @@ body { text-align: center; margin-top: 50px; display: flex; - } .container input[type="submit"] { @@ -23,45 +20,54 @@ body { } .btns { - text-align: center; - margin-top: 20px; + display: flex; + gap: 16px; + justify-content: center; + flex-wrap: wrap; } -.texts{ + +.texts { text-align: center; margin-top: 20px; color: #1c09ef; font-size: 25px; } -.main-container{ - display: flex ; + +.main-container { + display: flex; justify-content: center; align-items: center; flex-direction: column; width: 100vw; height: 50vh; } + .btns input[type="submit"] { - padding: 30px; - font-size: 21px; - text-align: center; - cursor: pointer; - color: #fff; - background-color: #0ca5bc; - border-radius: 20px; - box-shadow: 0 10px #999; - height: 12vh; + padding: 30px; + font-size: 21px; + text-align: center; + cursor: pointer; + color: #fff; + background-color: #0ca5bc; + border-radius: 20px; + box-shadow: 0 10px #999; + height: 12vh; } .btns input[type="submit"]:hover { background-color: #000000 } - .laps { - text-align: center; + display: flex; + flex-direction: column; + align-items: center; + gap: 15px; margin-top: 20px; + color: white; } -.with_text{ + +.with_text { display: flex; flex-direction: column; -} +} \ No newline at end of file diff --git a/Timer/timer.html b/Timer/timer.html index 71d9a58..89825fb 100644 --- a/Timer/timer.html +++ b/Timer/timer.html @@ -9,42 +9,45 @@ -
    -
    - - -

    Day

    - -
    -

    :

    - - - - -

    Hour

    -
    -

    :

    - - -

    Min

    - -
    -

    :

    - - - - -

    Sec

    - -
    +
    +
    + + + +

    Day

    +
    + +
    +

    :

    + + + + + +

    Hour

    +
    +
    +

    :

    + + + +

    Min

    +
    + +
    +

    :

    + + + + + +

    Sec

    +
    + +
    +
    -
    @@ -53,8 +56,7 @@

    :

    -
    -
    +
    diff --git a/Url-Shortner/connect.js b/Url-Shortner/connect.js new file mode 100644 index 0000000..1f08161 --- /dev/null +++ b/Url-Shortner/connect.js @@ -0,0 +1,7 @@ +const mongoose=require("mongoose") +async function connectToMongoDB(url){ + return mongoose.connect(url); +} +module.exports={ + connectToMongoDB, +} \ No newline at end of file diff --git a/Url-Shortner/controllers/url.js b/Url-Shortner/controllers/url.js new file mode 100644 index 0000000..22ba5f6 --- /dev/null +++ b/Url-Shortner/controllers/url.js @@ -0,0 +1,33 @@ +const shortid = require("shortid"); +const URL = require("../models/url"); + +async function handleGenerateNewShortURL(req, res) { + const body = req.body; + if (!body.url) return res.status(400).json({ error: "url is required" }); + const shortID = shortid(); + + await URL.create({ + shortId: shortID, + redirectURL: body.url, + visitHistory: [], + + }); + + return res.render("home", { + id: shortID, + }); +} + +async function handleAnalytics(req, res) { + const shortId = req.params.shortId; + const result = await URL.findOne({ shortId }); + return res.json({ + totalClicks: result.visitHistory.length, + analytics: result.visitHistory, + }); +} + +module.exports = { + handleGenerateNewShortURL, + handleAnalytics, +}; diff --git a/Url-Shortner/index.js b/Url-Shortner/index.js new file mode 100644 index 0000000..2f22955 --- /dev/null +++ b/Url-Shortner/index.js @@ -0,0 +1,43 @@ +const express = require("express"); +const path = require("path"); +const cookieParser = require("cookie-parser"); +const { connectToMongoDB } = require("./connect"); +const URL = require("./models/url"); +const urlRoute = require("./routes/url"); +const staticRoute = require("./routes/staticRouter"); +const app = express(); +const PORT = 3000; + +connectToMongoDB(process.env.MONGODB ?? "mongodb://localhost:27017/short-url").then(() => + console.log("Mongodb connected") +); + +app.set("view engine", "ejs"); +app.set("views", path.resolve("./views")); + +app.use(express.json()); +app.use(express.urlencoded({ extended: false })); +app.use(cookieParser()); + +app.use("/url", urlRoute); + +app.use("/", staticRoute); + +app.get("/url/:shortId", async (req, res) => { + const shortId = req.params.shortId; + const entry = await URL.findOneAndUpdate( + { + shortId, + }, + { + $push: { + visitHistory: { + timestamp: Date.now(), + }, + }, + } + ); + res.redirect(entry.redirectURL); +}); + +app.listen(PORT, () => console.log(`Server Started at PORT:${PORT}`)); diff --git a/Url-Shortner/models/url.js b/Url-Shortner/models/url.js new file mode 100644 index 0000000..bb04e31 --- /dev/null +++ b/Url-Shortner/models/url.js @@ -0,0 +1,25 @@ +const mongoose = require("mongoose"); + +const urlSchema = new mongoose.Schema( + { + shortId: { + type: String, + required: true, + unique: true, + }, + redirectURL: { + type: String, + required: true, + }, + visitHistory: [{ timestamp: { type: Number } }], + createdBy: { + type: mongoose.Schema.Types.ObjectId, + ref: "users", + }, + }, + { timestamps: true } +); + +const URL = mongoose.model("url", urlSchema); + +module.exports = URL; diff --git a/Url-Shortner/package-lock.json b/Url-Shortner/package-lock.json new file mode 100644 index 0000000..776934b --- /dev/null +++ b/Url-Shortner/package-lock.json @@ -0,0 +1,1075 @@ +{ + "name": "urlshort", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "urlshort", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "cookie-parser": "^1.4.6", + "ejs": "^3.1.9", + "express": "^4.18.2", + "mongoose": "^7.5.2", + "nanoid": "^5.0.1", + "shortid": "^2.2.16", + "uuid": "^9.0.1" + } + }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.0.tgz", + "integrity": "sha512-Xfijy7HvfzzqiOAhAepF4SGN5e9leLkMvg/OPOF97XemjfVCYN/oWa75wnkc6mltMSTwY+XlbhWgUOJmkFspSw==", + "optional": true, + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, + "node_modules/@types/node": { + "version": "20.6.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.5.tgz", + "integrity": "sha512-2qGq5LAOTh9izcc0+F+dToFigBWiK1phKPt7rNhOqJSr35y8rlIBjDwGtFSgAI6MGIhjwOVNSQZVdJsZJ2uR1w==" + }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.1.tgz", + "integrity": "sha512-8hKOnOan+Uu+NgMaCouhg3cT9x5fFZ92Jwf+uDLXLu/MFRbXxlWwGeQY7KVHkeSft6RvY+tdxklUBuyY9eIEKg==" + }, + "node_modules/@types/whatwg-url": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz", + "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==", + "dependencies": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/bson": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.0.tgz", + "integrity": "sha512-B+QB4YmDx9RStKv8LLSl/aVIEV3nYJc3cJNNTK2Cd1TL+7P+cNpw9mAPeCgc5K+j01Dv6sxUzcITXDx7ZU3F0w==", + "engines": { + "node": ">=14.20.1" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-parser": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", + "dependencies": { + "cookie": "0.4.1", + "cookie-signature": "1.0.6" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/cookie-parser/node_modules/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/ejs": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz", + "integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/jake": { + "version": "10.8.7", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz", + "integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==", + "dependencies": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/kareem": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz", + "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "optional": true + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mongodb": { + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.8.1.tgz", + "integrity": "sha512-wKyh4kZvm6NrCPH8AxyzXm3JBoEf4Xulo0aUWh3hCgwgYJxyQ1KLST86ZZaSWdj6/kxYUA3+YZuyADCE61CMSg==", + "dependencies": { + "bson": "^5.4.0", + "mongodb-connection-string-url": "^2.6.0", + "socks": "^2.7.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "optionalDependencies": { + "@mongodb-js/saslprep": "^1.1.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.0.0", + "kerberos": "^1.0.0 || ^2.0.0", + "mongodb-client-encryption": ">=2.3.0 <3", + "snappy": "^7.2.2" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz", + "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==", + "dependencies": { + "@types/whatwg-url": "^8.2.1", + "whatwg-url": "^11.0.0" + } + }, + "node_modules/mongoose": { + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.5.2.tgz", + "integrity": "sha512-yEkmI1jfiog7QUvMWz3eB/XoA3/5DrVvSz+z3V5hnq8VtZIHC7ujEV0RKzRXwr8QNMOs+OTB7+aK7R/N/V3yXA==", + "dependencies": { + "bson": "^5.4.0", + "kareem": "2.5.1", + "mongodb": "5.8.1", + "mpath": "0.9.0", + "mquery": "5.0.0", + "ms": "2.1.3", + "sift": "16.0.1" + }, + "engines": { + "node": ">=14.20.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mongoose" + } + }, + "node_modules/mongoose/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/mpath": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", + "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mquery": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", + "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", + "dependencies": { + "debug": "4.x" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/mquery/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mquery/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/nanoid": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.1.tgz", + "integrity": "sha512-vWeVtV5Cw68aML/QaZvqN/3QQXc6fBfIieAlu05m7FZW2Dgb+3f0xc0TTxuJW+7u30t7iSDTV/j3kVI0oJqIfQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^18 || >=20" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/shortid": { + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", + "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dependencies": { + "nanoid": "^2.1.0" + } + }, + "node_modules/shortid/node_modules/nanoid": { + "version": "2.1.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", + "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sift": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz", + "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==" + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "optional": true, + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + } + } +} diff --git a/Url-Shortner/package.json b/Url-Shortner/package.json new file mode 100644 index 0000000..252e5a4 --- /dev/null +++ b/Url-Shortner/package.json @@ -0,0 +1,20 @@ +{ + "name": "urlshort", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "cookie-parser": "^1.4.6", + "ejs": "^3.1.9", + "express": "^4.18.2", + "mongoose": "^7.5.2", + "nanoid": "^5.0.1", + "shortid": "^2.2.16", + "uuid": "^9.0.1" + } +} diff --git a/Url-Shortner/routes/staticRouter.js b/Url-Shortner/routes/staticRouter.js new file mode 100644 index 0000000..0561707 --- /dev/null +++ b/Url-Shortner/routes/staticRouter.js @@ -0,0 +1,14 @@ +const express = require("express"); +const URL = require("../models/url"); + +const router = express.Router(); + +router.get("/", async (req, res) => { + const allurls = await URL.find({ }); + return res.render("home", { + urls: allurls, + }); +}); + + +module.exports = router; diff --git a/Url-Shortner/routes/url.js b/Url-Shortner/routes/url.js new file mode 100644 index 0000000..6c63875 --- /dev/null +++ b/Url-Shortner/routes/url.js @@ -0,0 +1,13 @@ +const express = require("express"); +const { + handleGenerateNewShortURL, + handleAnalytics, +} = require("../controllers/url"); + +const router = express.Router(); + +router.post("/", handleGenerateNewShortURL); + +router.get("/analytics/:shortId", handleAnalytics); + +module.exports = router; diff --git a/Url-Shortner/service/auth.js b/Url-Shortner/service/auth.js new file mode 100644 index 0000000..77e5a5e --- /dev/null +++ b/Url-Shortner/service/auth.js @@ -0,0 +1,14 @@ +const sessionIdToUserMap = new Map(); + +function setUser(id, user) { + sessionIdToUserMap.set(id, user); +} + +function getUser(id) { + return sessionIdToUserMap.get(id); +} + +module.exports = { + setUser, + getUser, +}; diff --git a/Url-Shortner/views/home.ejs b/Url-Shortner/views/home.ejs new file mode 100644 index 0000000..bad8e75 --- /dev/null +++ b/Url-Shortner/views/home.ejs @@ -0,0 +1,51 @@ + + + + + + + + Home Page + + +

    URL SHORTNER

    + <% if (locals.id) { %> +

    Generated short URL : http://localhost:3000/url/<%= id %>

    + <% } %> + +
    + + + + + +
    +
    +

    Analytics of your Generated url

    + <% if (locals.urls) { %> + + + + + + + + + <% urls.forEach((url, index) => { %> + + + + + + + <% }) %> + +
    S. NoShortIDRedirectClicks
    <%= index + 1 %><%= url.shortId %><%= url.redirectURL %><%= url.visitHistory.length %>
    + <% } %> +
    + + diff --git a/chrome-dino/.DS_Store b/chrome-dino/.DS_Store new file mode 100644 index 0000000..8d7cfe2 Binary files /dev/null and b/chrome-dino/.DS_Store differ diff --git a/chrome-dino/img/.DS_Store b/chrome-dino/img/.DS_Store new file mode 100644 index 0000000..ca6410c Binary files /dev/null and b/chrome-dino/img/.DS_Store differ diff --git a/chrome-dino/img/cactus.png b/chrome-dino/img/cactus.png new file mode 100644 index 0000000..b1c104d Binary files /dev/null and b/chrome-dino/img/cactus.png differ diff --git a/chrome-dino/img/trex.png b/chrome-dino/img/trex.png new file mode 100644 index 0000000..60f4665 Binary files /dev/null and b/chrome-dino/img/trex.png differ diff --git a/chrome-dino/index.html b/chrome-dino/index.html new file mode 100644 index 0000000..768cf6b --- /dev/null +++ b/chrome-dino/index.html @@ -0,0 +1,16 @@ + + + + + + Document + + + +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/chrome-dino/scripts.js b/chrome-dino/scripts.js new file mode 100644 index 0000000..c968697 --- /dev/null +++ b/chrome-dino/scripts.js @@ -0,0 +1,27 @@ + +const dino = document.getElementById("dino"); +const cactus = document.getElementById("cactus"); + +function jump() { + if (!dino.classList.contains("jump")) { + dino.classList.add("jump"); + + setTimeout(function () { + dino.classList.remove("jump"); + }, 300); + } +} + + +function checkCollision() { + let dinoTop = parseInt(window.getComputedStyle(dino).getPropertyValue("top")); + let cactusLeft = parseInt(window.getComputedStyle(cactus).getPropertyValue("left")); + + if (cactusLeft < 50 && cactusLeft > 0 && dinoTop >= 140) { + alert("Game Over!"); + } +} + +let isAlive = setInterval(checkCollision, 10); + +document.addEventListener("keydown", jump); diff --git a/chrome-dino/styles.css b/chrome-dino/styles.css new file mode 100644 index 0000000..addb0df --- /dev/null +++ b/chrome-dino/styles.css @@ -0,0 +1,64 @@ +.game { + width: 800px; + height: 200px; + border: 1px solid black; + margin: auto; + } + + #dino { + width: 50px; + height: 50px; + background-image: url(img/trex.png); + background-size: 50px 50px; + position: relative; + top: 150px; + } + + .jump { + animation: jump 0.3s linear; + } + + @keyframes jump { + 0% { + top: 150px; + } + + 30% { + top: 130px; + } + + 50% { + top: 80px; + } + + 80% { + top: 130px; + } + + 100% { + top: 150px; + } + } + + #cactus { + width: 20px; + height: 40px; + position: relative; + top: 110px; + left: 580px; + + background-image: url("img/cactus.png"); + background-size: 20px 40px; + + animation: block 1s infinite linear; + } + + @keyframes block { + 0% { + left: 580px; + } + + 100% { + left: -20px; + } + } \ No newline at end of file diff --git a/contributors.html b/contributors.html new file mode 100644 index 0000000..9dd6235 --- /dev/null +++ b/contributors.html @@ -0,0 +1,123 @@ + + + + + + + JS Beginner Projects + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + +
    + + + +

    Contributors

    +
    +
    +
    +
      +
    +
    +
    +
    + \ No newline at end of file diff --git a/css/style.css b/css/style.css index 3f828e6..e7eb89c 100644 --- a/css/style.css +++ b/css/style.css @@ -1,230 +1,105 @@ -/* :root { - --white-color-lv5: #dfdfdf; - --dark-color-lv5: #212121; +/*removed comment tag, hindring the display of colors */ +:root { + --white-color-lv5: #fff; + --dark-color-lv5: #36454F; } * { - margin: 0; - padding: 0; - box-sizing: border-box; -} -<<<<<<< HEAD -a, a:hover, a:link, a:visited, a:active{ - text-decoration: none; - color: var(--white-color-lv5); + margin: 0; + padding: 0; + box-sizing: border-box; } -body { - padding: 20px; - font-family: 'Outfit', sans-serif; - display: flex; - align-items: center; - flex-direction: column; - row-gap: 30px; - height: 100vh; - background: linear-gradient(135deg, rgb(212, 0, 240), rgb(0, 101, 216)); - color: var(--white-color-lv5); +/*navbar-text-item styling*/ +.display-7 { + font-size: 1.5em; + font-weight: 500; } - -.projectsName { - display: flex; - padding: 0.5rem 1.5rem; - background: rgba(255, 255, 255, 0.178); - -webkit-box-shadow: 10px 10px 77px -15px rgba(0, 0, 0, 0.733); - -moz-box-shadow: 10px 10px 77px -15px rgba(0, 0, 0, 0.75); - box-shadow: 10px 10px 77px -15px rgba(0, 0, 0, 0.75); - border-radius: 30px; - transition: 0.3s ease-in-out; +.nav-link:hover { + color: #fff !important; } -.projectsName:hover { - background: rgba(255, 255, 255, 0.295); - cursor: pointer; +.Heading{ + border-bottom: 1px solid ; } -======= -body { - width: 100vw; - overflow-x: hidden; - font-family: 'Kanit', sans-serif; - font-family: 'Libre Franklin', sans-serif; - font-family: 'Work Sans', sans-serif; +/* mobile header: start */ +.mobile-header .navbar-toggler:is(:focus, :active) { + outline: none; + /* add white box shadow */ + box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.75); } ->>>>>>> 2caac8c1f80989d3e90ddd5af6d5780934e33bbc -.gamesAndProjects { - display: flex; - flex-wrap: wrap; - flex-shrink: 1; - flex-basis: auto; - overflow: hidden; - row-gap: 20px; - column-gap: 20px; - align-items: center; - justify-content: center; -} */ -:root { - --white-color-lv5: #dfdfdf; - --dark-color-lv5: #212121; - --primary-color: rgb(212, 0, 240); - --secondary-color: rgb(0, 101, 216); -} +/* mobile header: end */ -<<<<<<< HEAD -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} -a, a:hover, a:link, a:visited, a:active { - text-decoration: none; - color: var(--white-color-lv5); +a, +a:hover, +a:link, +a:visited, +a:active { + text-decoration: none; + color: var(--white-color-lv5); } body { - padding: 20px; - font-family: 'Outfit', sans-serif; - background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); - color: var(--white-color-lv5); - text-align: center; -} - -header { - margin-bottom: 20px; -} + /* padding: 10px; */ + font-family: 'Outfit', sans-serif; + display: flex; + + flex-direction: column; + row-gap: 30px; + + height: 100vh; -h1 { - font-size: 2rem; + background-color: #141d2f !important; + color: #fff; } -.projectLink { - text-align: center; - text-decoration: none; - margin: 10px; -} - -.projectCard { - opacity: 1; - transform: translate3d(0, 50px, 0); - padding: 20px; - background: rgba(255, 255, 255, 0.2); - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); - border-radius: 10px; - transition: background 0.3s ease-in-out; - margin-bottom: auto; -} -.projectCard.in-view { - opacity: 1; - transform: translate3d(0, 0, 0); - } .projectsName { - font-size: 1.5rem; -} - -.projectCard:hover { - background: rgba(255, 255, 255, 0.3); - cursor: pointer; -======= -/* NEW HOMEPAGE */ - - -.header { - width: 100%; - position: fixed; - height: 80px; - background-color: rgb(255, 255, 255); - display: flex; - justify-content: space-between; - align-items: center; - padding-inline: 2rem; - z-index: 99999; -} - -.header a { - text-decoration: none; - width: 8rem; - height: 2.5rem; - border: none; - border-radius: 0.2rem; - cursor: pointer; - display: flex; - justify-content: center; - align-items: center; - gap: 5%; - background-color: #1E40AF; - color: white; + display: flex; + padding: 0.5rem 1.5rem; + background: #1e2a47; + + border-radius: 30px; + border: 1px solid #1e2a47; + margin: auto; + transition: 0.3s ease-in-out; } -.header a:hover { - transform: scale(1.05); - transition: all 0.3s ease; -} - -.hero-container { - padding: 100px 0; - width: 100%; - display: flex; - justify-content: center; - align-items: center; - background-color: #F1F5F9; -} - -.hero-section { - width: 90%; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - gap: 5rem; - text-align: center; -} - -.project-parent { - width: 100%; - /* min-height:70vh; */ - display: flex; - justify-content: center; - gap: 2rem; - flex-wrap: wrap; -} - -.project-parent a { - width: 100%; - height: 100%; - text-decoration: none; - color: white; - text-align: center; - display: flex; - align-items: center; - justify-content: center; -} - -.project-child { - min-width: 8rem; - height: 3rem; - background-color: rgb(255, 255, 255); - border-radius: 0.4rem; - padding-inline: 1rem; - text-align: center; - display: flex; - flex-direction: column; - justify-content: center; - color: #1E40AF; - border: 3px solid #1E40AF; -} - -.project-child a { - width: 100%; - height: 100%; - text-decoration: none; - color: #1E40AF; - font-size: 1.2rem; - font-weight: 600; +.projectsName:hover { + background: rgba(80, 75, 75, 0.295); + cursor: pointer; } -.project-child:hover { - transform: scale(1.05); - transition: all 0.3s ease; ->>>>>>> 2caac8c1f80989d3e90ddd5af6d5780934e33bbc +.gamesAndProjects { + display: flex; + flex-wrap: wrap; + flex-shrink: 1; + flex-basis: auto; + overflow: hidden; + row-gap: 20px; + column-gap: 20px; + align-items: center; + justify-content: center; + padding: 5px; + margin: auto; +} + +.hvr-sweep-to-right::before { + border-radius: 30px; + background-color: #47699ca6; + /* glow */ + box-shadow: 0 0 5px 0.5px #fff; +} +.nav-tabs{ + border-bottom: 0px; +} +.navbar{ + background-color: #141d2f; + box-shadow: 0px 15px 10px -15px #ddd; +} +.cards{ + background-color:#1e2a47 ; + padding: 20px 40px !important; } \ No newline at end of file diff --git a/dictionary/index.html b/dictionary/index.html new file mode 100644 index 0000000..220c3c1 --- /dev/null +++ b/dictionary/index.html @@ -0,0 +1,25 @@ + + + + + + + Dictionary app + + + +
    +

    English Dictionary

    + +

    Type a word and press enter

    + +
    +

    Word Title : ___

    +

    Meaning : ___

    + +
    +
    + + + + diff --git a/dictionary/script.js b/dictionary/script.js new file mode 100644 index 0000000..8f9d5fe --- /dev/null +++ b/dictionary/script.js @@ -0,0 +1,46 @@ +const inputEl = document.getElementById("input"); +const infoTextEl = document.getElementById("info-text"); +const meaningContainerEl = document.getElementById("meaning-container"); +const titleEl = document.getElementById("title"); +const meaningEl = document.getElementById("meaning"); +const audioEl = document.getElementById("audio"); + +async function fetchAPI(word) { + try { + infoTextEl.style.display = "block"; + meaningContainerEl.style.display = "none"; + + infoTextEl.innerText = `Searching the meaning of "${word}" `; + + const url = `https://api.dictionaryapi.dev/api/v2/entries/en/${word}`; + const res = await fetch(url).then((res) => res.json()); + + if (res.title) { + meaningContainerEl.style.display = "block"; + infoTextEl.style.display = "none"; + + titleEl.innerText = word; + meaningEl.innerText = "N/A"; + audioEl.style.display = "none"; + } else { + infoTextEl.style.display = "none"; + meaningContainerEl.style.display = "block"; + audioEl.style.display = "inline-flex"; + + titleEl.innerText = res[0].word; + meaningEl.innerText = res[0].meanings[0].definitions[0].definition; + audioEl.src = res[0].phonetics[0].audio; + } + } catch (error) { + console.log(error); + infoTextEl.innerText = ` "${error}" `; + } +} + +inputEl.addEventListener("keyup", (e) => { + // input shouldn't be empty + // accept only when something is typed and then enter is pressed , else not + if (e.target.value && e.key === "Enter") { + fetchAPI(e.target.value); + } +}); diff --git a/dictionary/style.css b/dictionary/style.css new file mode 100644 index 0000000..5101326 --- /dev/null +++ b/dictionary/style.css @@ -0,0 +1,43 @@ +body { + margin: 0; + padding: 8px; + background-color: palegoldenrod; + display: flex; + min-height: 100vh; + justify-content: center; + align-items: center; +} + +.container { + border-radius: 12px; + box-shadow: 3px 5px 6px; + padding: 32px; + background-color: peachpuff; + width: 65%; + margin: 10px; + max-width: 450px; + text-align: center; +} + +h2 { + font-family: "Courier New", Courier, monospace; + font-size: 28px; + font-weight: 800; +} +.input { + border-radius: 8px; + border: solid; + border-width: 2px; + padding: 12px; + width: 60%; + background-color: rgba(255, 255, 255, 0.65); +} +.info-text { + font-size: 400; + font-family: cursive; + text-align: center; + font-size: 16px; +} +.meaning-container { + display: none; +} diff --git a/index.html b/index.html index 88c7c67..6eb4a6a 100644 --- a/index.html +++ b/index.html @@ -1,160 +1,130 @@ - + - - - JS Beginner Projects - - + + + + JS Beginner Projects + + + + + + + + + + + + + -
    -

    Small JavaScript Projects

    -
    -
    - -
    -
    Analog Clock
    -
    -
    - -
    -
    Alarm Clock
    -
    -
    - -
    -
    BMI calculator
    -
    -
    - -
    -
    Calender
    -
    - -
    - -
    -
    Code Visualizer
    -
    -
    - -
    -
    Color Changing Background
    + + +
    + +
    + + + +
    + +
    +

    small javascript projects

    +
    +
    + + + + + + +
    + Analog Clock + Alarm Clock + BMI calculator + Calender + Code Visualizer + Color + Changing Background + Credit card validate + + CSS Line Height and Letter Spacing Generator + + CSS Shadow Generator + Currency + Converter + Digital Clock + Dictionary App + Game of Life + GitHub Card + Guess The Number + Hang Man + Calculator + Movie App + Music App + Quote Generator + Race Game + Random Password + Generator + Simon Game + Snake Game + Tic Tac Toe + Text to Speech Convertor + Timer + To Do List + Unlimited Color + Weather App
    - + + + + + + + \ No newline at end of file diff --git a/memory/README.md b/memory/README.md new file mode 100755 index 0000000..be9e290 --- /dev/null +++ b/memory/README.md @@ -0,0 +1,29 @@ + MEMORY GAME + +## RESULT + +![screenshot](./images/result.png) + +It's a simple grid game, in which you as a player needs to flip over two cards. If the two cards match thats a point for you and the card is take off the board, leaving with you the remainder that you also have to flip over. The game is completed when you flipped over all the cards. + +#### HTML Structure + +- div.container +- h3 + - span#result +- span.notification +- div.grid + +#### FLIP CARD + +- flipCard() +- gets the data-id of the card +- push the id to cardsChosen & cardsChosen Array +- set the clicked card source to the cardArray item whoose position is equal to the data-id +- check if the card is equal to 2 + +#### CHECKFORMATCH + +- checkForMatch() +- if the card chosen are the same let the clicked card be blank and let 1 be added to the score +- else it will notify you with you picked the wrong card diff --git a/memory/files/click.wav b/memory/files/click.wav new file mode 100755 index 0000000..7b5e674 Binary files /dev/null and b/memory/files/click.wav differ diff --git a/memory/files/complete.wav b/memory/files/complete.wav new file mode 100755 index 0000000..00ec94f Binary files /dev/null and b/memory/files/complete.wav differ diff --git a/memory/files/correct.wav b/memory/files/correct.wav new file mode 100755 index 0000000..802e6a6 Binary files /dev/null and b/memory/files/correct.wav differ diff --git a/memory/files/wrong.wav b/memory/files/wrong.wav new file mode 100755 index 0000000..d29deea Binary files /dev/null and b/memory/files/wrong.wav differ diff --git a/memory/images/cheeseburger.png b/memory/images/cheeseburger.png new file mode 100755 index 0000000..5ae481d Binary files /dev/null and b/memory/images/cheeseburger.png differ diff --git a/memory/images/diamond.jpg b/memory/images/diamond.jpg new file mode 100755 index 0000000..5c3088c Binary files /dev/null and b/memory/images/diamond.jpg differ diff --git a/memory/images/fries.png b/memory/images/fries.png new file mode 100755 index 0000000..ac0a5ca Binary files /dev/null and b/memory/images/fries.png differ diff --git a/memory/images/hotdog.png b/memory/images/hotdog.png new file mode 100755 index 0000000..e67d875 Binary files /dev/null and b/memory/images/hotdog.png differ diff --git a/memory/images/ice-cream.png b/memory/images/ice-cream.png new file mode 100755 index 0000000..a6d79a9 Binary files /dev/null and b/memory/images/ice-cream.png differ diff --git a/memory/images/milkshake.png b/memory/images/milkshake.png new file mode 100755 index 0000000..7be827b Binary files /dev/null and b/memory/images/milkshake.png differ diff --git a/memory/images/pink-polygonal-vector-background.jpg b/memory/images/pink-polygonal-vector-background.jpg new file mode 100755 index 0000000..e426d40 Binary files /dev/null and b/memory/images/pink-polygonal-vector-background.jpg differ diff --git a/memory/images/pizza.png b/memory/images/pizza.png new file mode 100755 index 0000000..9934744 Binary files /dev/null and b/memory/images/pizza.png differ diff --git a/memory/images/result.png b/memory/images/result.png new file mode 100644 index 0000000..59f8e5d Binary files /dev/null and b/memory/images/result.png differ diff --git a/memory/images/white.png b/memory/images/white.png new file mode 100755 index 0000000..5e9ac9f Binary files /dev/null and b/memory/images/white.png differ diff --git a/memory/index.html b/memory/index.html new file mode 100755 index 0000000..bcf6ba3 --- /dev/null +++ b/memory/index.html @@ -0,0 +1,18 @@ + + + + + + + Memory + + + +
    +

    Score:

    + +
    +
    + + + \ No newline at end of file diff --git a/memory/index.js b/memory/index.js new file mode 100755 index 0000000..4d0a96d --- /dev/null +++ b/memory/index.js @@ -0,0 +1,125 @@ +const cardArray = [ + { + name: "fries", + img: "images/fries.png", + }, + { + name: "cheeseburger", + img: "images/cheeseburger.png", + }, + { + name: "ice-cream", + img: "images/ice-cream.png", + }, + { + name: "pizza", + img: "images/pizza.png", + }, + { + name: "milkshake", + img: "images/milkshake.png", + }, + { + name: "hotdog", + img: "images/hotdog.png", + }, + { + name: "fries", + img: "images/fries.png", + }, + { + name: "cheeseburger", + img: "images/cheeseburger.png", + }, + { + name: "ice-cream", + img: "images/ice-cream.png", + }, + { + name: "pizza", + img: "images/pizza.png", + }, + { + name: "milkshake", + img: "images/milkshake.png", + }, + { + name: "hotdog", + img: "images/hotdog.png", + }, +]; + + +cardArray.sort(() => 0.5 - Math.random()); + +const grid = document.querySelector(".grid"); +const resultDisplay = document.querySelector("#result"); +let cardsChosen = []; +let cardsChosenId = []; +let cardsWon = []; + +let createBoard = (() => { + for (let i = 0; i < cardArray.length; i++) { + const card = document.createElement("img"); + card.setAttribute("src", "images/pink-polygonal-vector-background.jpg"); + card.setAttribute("data-id", i); + card.classList.add("card"); + card.addEventListener("click", flipCard); + grid.appendChild(card); + } +})(); + +function flipCard() { + let cardId = this.getAttribute("data-id"); + playSound("./files/click.wav"); + cardsChosen.push(cardArray[cardId].name); + cardsChosenId.push(cardId); + this.setAttribute("src", cardArray[cardId].img); + if (cardsChosen.length === 2) { + setTimeout(checkForMatch, 500); + } + notify.innerHTML = ""; +} + +function checkForMatch() { + const notify = document.querySelector(".notification"); + const cards = document.querySelectorAll("img"); + const optionOneId = cardsChosenId[0]; + const optionTwoId = cardsChosenId[1]; + + if (optionOneId == optionTwoId) { + attribute("images/pink-polygonal-vector-background.jpg"); + notify.innerHTML = `
  • You have clicked the same image!
  • `; + } else if (cardsChosen[0] === cardsChosen[1]) { + notify.innerHTML = `
  • You found a match
  • `; + attribute("images/white.png"); + playSound("./files/correct.wav"); + cards[optionOneId].removeEventListener("click", flipCard); + cards[optionTwoId].removeEventListener("click", flipCard); + cardsWon.push(cardsChosen); + } else { + attribute("images/pink-polygonal-vector-background.jpg"); + notify.innerHTML = `
  • Sorry, try again
  • `; + } + + function attribute(value) { + cards[optionOneId].setAttribute("src", value); + cards[optionTwoId].setAttribute("src", value); + } + + cardsChosen = []; + cardsChosenId = []; + resultDisplay.textContent = cardsWon.length; + playSound("./files/wrong.wav"); + + if (cardsWon.length === cardArray.length / 2) { + resultDisplay.textContent = "Congratulations! You found them all!"; + notify.innerHTML = ""; + playSound("./files/complete.wav"); + } +} + +function playSound(src) { + let sound = new Audio(src); + sound.play(); +} diff --git a/memory/styles.css b/memory/styles.css new file mode 100755 index 0000000..df39b12 --- /dev/null +++ b/memory/styles.css @@ -0,0 +1,75 @@ +:root { + --shadow: rgba(240, 46, 170, 0.4) 0px -23px 25px 0px inset, + rgba(0, 0, 0, 0.15) 0px -36px 30px 0px inset, + rgba(0, 0, 0, 0.1) 0px -79px 40px 0px inset, rgba(0, 0, 0, 0.06) 0px 2px 1px, + rgba(0, 0, 0, 0.09) 0px 4px 2px, rgba(0, 0, 0, 0.09) 0px 8px 4px, + rgba(0, 0, 0, 0.09) 0px 16px 8px, rgba(0, 0, 0, 0.09) 0px 32px 16px; +} + +body { + background: url("images/diamond.jpg"); + background-repeat: no-repeat; +} + +.container { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.grid { + display: flex; + flex-wrap: wrap; + height: 23rem; + width: 28rem; + gap: 1rem; + border-radius: 4rem; +} + +.container img { + box-shadow: rgba(240, 46, 170, 0.4) -5px 5px, + rgba(240, 46, 170, 0.3) -10px 10px, rgba(240, 46, 170, 0.2) -15px 15px, + rgba(240, 46, 170, 0.1) -20px 20px, rgba(240, 46, 170, 0.05) -25px 25px; + border-radius: 1rem; +} + +.container h3 { + font-size: 32px; + padding: 1rem; + border-radius: 1rem; + box-shadow: var(--shadow); +} + +.notification{ + padding: 1rem; +} + +li { + list-style: none; + position: absolute; + top: 7rem; + left: 15rem; + padding: 1rem; + border-radius: 1rem; + box-shadow: var(--shadow); + margin-bottom: 1rem; +} + +.card { + width: 100px; + height: 100px; +} + +@media screen and (max-width: 720px) { + .grid { + width: 22rem; + } + .notification{ + padding: 0; + } + li{ + top: 5rem; + left: 30rem; + } +} diff --git a/musical_instrumental_app/drum1.png b/musical_instrumental_app/drum1.png new file mode 100644 index 0000000..1f1eb20 Binary files /dev/null and b/musical_instrumental_app/drum1.png differ diff --git a/musical_instrumental_app/drum_kit.png b/musical_instrumental_app/drum_kit.png new file mode 100644 index 0000000..ea05e45 Binary files /dev/null and b/musical_instrumental_app/drum_kit.png differ diff --git a/musical_instrumental_app/images/crash.png b/musical_instrumental_app/images/crash.png new file mode 100644 index 0000000..a992fa0 Binary files /dev/null and b/musical_instrumental_app/images/crash.png differ diff --git a/musical_instrumental_app/images/kick.png b/musical_instrumental_app/images/kick.png new file mode 100644 index 0000000..b64877e Binary files /dev/null and b/musical_instrumental_app/images/kick.png differ diff --git a/musical_instrumental_app/images/music1.png b/musical_instrumental_app/images/music1.png new file mode 100644 index 0000000..d8f4334 Binary files /dev/null and b/musical_instrumental_app/images/music1.png differ diff --git a/musical_instrumental_app/images/music2.png b/musical_instrumental_app/images/music2.png new file mode 100644 index 0000000..4d83ab3 Binary files /dev/null and b/musical_instrumental_app/images/music2.png differ diff --git a/musical_instrumental_app/images/snare.png b/musical_instrumental_app/images/snare.png new file mode 100644 index 0000000..1e089ba Binary files /dev/null and b/musical_instrumental_app/images/snare.png differ diff --git a/musical_instrumental_app/images/tom1.png b/musical_instrumental_app/images/tom1.png new file mode 100644 index 0000000..855b211 Binary files /dev/null and b/musical_instrumental_app/images/tom1.png differ diff --git a/musical_instrumental_app/images/tom2.png b/musical_instrumental_app/images/tom2.png new file mode 100644 index 0000000..3e9f363 Binary files /dev/null and b/musical_instrumental_app/images/tom2.png differ diff --git a/musical_instrumental_app/images/tom3.png b/musical_instrumental_app/images/tom3.png new file mode 100644 index 0000000..762cbf8 Binary files /dev/null and b/musical_instrumental_app/images/tom3.png differ diff --git a/musical_instrumental_app/images/tom4.png b/musical_instrumental_app/images/tom4.png new file mode 100644 index 0000000..e79c49e Binary files /dev/null and b/musical_instrumental_app/images/tom4.png differ diff --git a/musical_instrumental_app/index.html b/musical_instrumental_app/index.html new file mode 100644 index 0000000..4d5a2e6 --- /dev/null +++ b/musical_instrumental_app/index.html @@ -0,0 +1,34 @@ + + + + + + + Drum Kit + + + +

    + Drum + image + Kit +

    + +
    + + + + + + + +
    + + + diff --git a/musical_instrumental_app/index1.js b/musical_instrumental_app/index1.js new file mode 100644 index 0000000..1316190 --- /dev/null +++ b/musical_instrumental_app/index1.js @@ -0,0 +1,67 @@ +var data = document.querySelectorAll(".drum"); + +for(var i = 0; i { + canvasContext.fillStyle = color; + canvasContext.fillRect(x, y, width, height); +}; + +const DIRECTION_RIGHT = 4; +const DIRECTION_UP = 3; +const DIRECTION_LEFT = 2; +const DIRECTION_BOTTOM = 1; +let lives = 3; +let foodCount = 213; +let ghostCount = 4; +let ghostImageLocations = [ + { x: 0, y: 0 }, + { x: 176, y: 0 }, + { x: 0, y: 121 }, + { x: 176, y: 121 }, +]; + +let fps = 30; +let pacman; +let oneBlockSize = 20; +let score = 0; +let ghosts = []; +let wallSpaceWidth = oneBlockSize / 1.6; +let wallOffset = (oneBlockSize - wallSpaceWidth) / 2; +let wallInnerColor = "black"; + +let map = [ + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], + [1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1], + [1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1], + [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], + [1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1], + [1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1], + [1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 0, 0, 0, 0], + [1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1], + [1, 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, 1, 2, 2, 2, 2, 2, 2, 2, 1], + [1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 3, 3, 1, 2, 1, 2, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 0, 0, 0, 0], + [1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1], + [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], + [1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1], + [1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1], + [1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1], + [1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1], + [1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1], + [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], +]; + +let randomTargetsForGhosts = [ + { x: 1 * oneBlockSize, y: 1 * oneBlockSize }, + { x: 1 * oneBlockSize, y: (map.length - 2) * oneBlockSize }, + { x: (map[0].length - 2) * oneBlockSize, y: oneBlockSize }, + { + x: (map[0].length - 2) * oneBlockSize, + y: (map.length - 2) * oneBlockSize, + }, +]; + +let createNewPacman = () => { + pacman = new Pacman( + oneBlockSize, + oneBlockSize, + oneBlockSize, + oneBlockSize, + oneBlockSize / 5 + ); +}; + +let gameLoop = () => { + draw(); + update(); +}; + +let gameInterval = setInterval(gameLoop, 1000 / fps); + +let restartPacmanAndGhosts = () => { + createNewPacman(); + createGhosts(); +}; + +let onGhostCollision = () => { + lives--; + restartPacmanAndGhosts(); + if (lives == 0) { + gameOver(); + drawGameOver(); + } +}; + +let gameOver = () => { + drawGameOver(); + clearInterval(gameInterval); +}; + +let drawGameOver = () => { + canvasContext.font = "20px Emulogic"; + canvasContext.fillStyle = "white"; + canvasContext.fillText("Game Over !", 170, 210); +}; + +let drawWin =()=>{ + canvasContext.font = "20px Emulogic"; + canvasContext.fillStyle = "white"; + canvasContext.fillText("You Won !", 170, 250); +} + +let update = () => { + pacman.moveProcess(); + pacman.eat(); + updateGhosts(); + if (pacman.checkGhostCollision(ghosts)) { + onGhostCollision(); + } + if(score>=foodCount){ + drawWin(); + gameOver(); + } +}; + +let drawFoods = () => { + for (let i = 0; i < map.length; i++) { + for (let j = 0; j < map[0].length; j++) { + if (map[i][j] == 2 ) { + createRect( + j * oneBlockSize + oneBlockSize / 3, + i * oneBlockSize + oneBlockSize / 3, + oneBlockSize / 3, + oneBlockSize / 3, + "#FEB897" + ); + } + } + } +}; + +let drawRemainingLives = () => { + canvasContext.font = "20px Emulogic"; + canvasContext.fillStyle = "white"; + canvasContext.fillText("Lives: ", 220, oneBlockSize * (map.length + 1) + 10); + + for (let i = 0; i < lives; i++) { + canvasContext.drawImage( + pacmanFrames, + 2 * oneBlockSize, + 0, + oneBlockSize, + oneBlockSize, + 350 + i * oneBlockSize, + oneBlockSize * map.length + 2, + oneBlockSize, + oneBlockSize + ); + } +}; + +let drawScore = () => { + canvasContext.font = "20px Emulogic"; + canvasContext.fillStyle = "white"; + canvasContext.fillText("Score: " + score, 0, oneBlockSize * (map.length + 1)); +}; + +let draw = () => { + canvasContext.clearRect(0, 0, canvas.width, canvas.height); + createRect(0, 0, canvas.width, canvas.height, "black"); + drawWalls(); + drawFoods(); + drawGhosts(); + pacman.draw(); + drawScore(); + drawRemainingLives(); +}; + +let drawWalls = () => { + for (let i = 0; i < map.length; i++) { + for (let j = 0; j < map[0].length; j++) { + if (map[i][j] == 1) { + createRect( + j * oneBlockSize, + i * oneBlockSize, + oneBlockSize, + oneBlockSize, + "#342DCA" + ); + if (j > 0 && map[i][j - 1] == 1) { + createRect( + j * oneBlockSize, + i * oneBlockSize + wallOffset, + wallSpaceWidth + wallOffset, + wallSpaceWidth, + wallInnerColor + ); + } + + if (j < map[0].length - 1 && map[i][j + 1] == 1) { + createRect( + j * oneBlockSize + wallOffset, + i * oneBlockSize + wallOffset, + wallSpaceWidth + wallOffset, + wallSpaceWidth, + wallInnerColor + ); + } + + if (i < map.length - 1 && map[i + 1][j] == 1) { + createRect( + j * oneBlockSize + wallOffset, + i * oneBlockSize + wallOffset, + wallSpaceWidth, + wallSpaceWidth + wallOffset, + wallInnerColor + ); + } + + if (i > 0 && map[i - 1][j] == 1) { + createRect( + j * oneBlockSize + wallOffset, + i * oneBlockSize, + wallSpaceWidth, + wallSpaceWidth + wallOffset, + wallInnerColor + ); + } + } + } + } +}; + +let createGhosts = () => { + ghosts = []; + for (let i = 0; i < ghostCount ; i++) { + let newGhost = new Ghost( + 9 * oneBlockSize + (i % 2 == 0 ? 0 : 1) * oneBlockSize, + 10 * oneBlockSize + (i % 2 == 0 ? 0 : 1) * oneBlockSize, + oneBlockSize, + oneBlockSize, + pacman.speed / 2, + ghostImageLocations[i % 4].x, + ghostImageLocations[i % 4].y, + 124, + 116, + 6 + i + ); + ghosts.push(newGhost); + } +}; + +createNewPacman(); +createGhosts(); +gameLoop(); + +window.addEventListener("keydown", (event) => { + let k = event.keyCode; + setTimeout(() => { + if (k == 37 || k == 65) { + pacman.nextDirection = DIRECTION_LEFT; + } else if (k == 38 || k == 87) { + pacman.nextDirection = DIRECTION_UP; + } else if (k == 39 || k == 68) { + pacman.nextDirection = DIRECTION_RIGHT; + } else if (k == 40 || k == 83) { + pacman.nextDirection = DIRECTION_BOTTOM; + } + }, 1); +}); diff --git a/pacman/ghost.js b/pacman/ghost.js new file mode 100644 index 0000000..a55bb56 --- /dev/null +++ b/pacman/ghost.js @@ -0,0 +1,278 @@ +class Ghost { + constructor( + x, + y, + width, + height, + speed, + imageX, + imageY, + imageWidth, + imageHeight, + range + ) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.speed = speed; + this.direction = DIRECTION_RIGHT; + this.imageX = imageX; + this.imageY = imageY; + this.imageHeight = imageHeight; + this.imageWidth = imageWidth; + this.range = range; + this.randomTargetIndex = parseInt(Math.random() * 4); + this.target = randomTargetsForGhosts[this.randomTargetIndex]; + setInterval(() => { + this.changeRandomDirection(); + }, 10000); + } + + isInRange() { + let xDistance = Math.abs(pacman.getMapX() - this.getMapX()); + let yDistance = Math.abs(pacman.getMapY() - this.getMapY()); + if ( + Math.sqrt(xDistance * xDistance + yDistance * yDistance) <= + this.range + ) { + return true; + } + return false; + } + + changeRandomDirection() { + let addition = 1; + this.randomTargetIndex += addition; + this.randomTargetIndex = this.randomTargetIndex % 4; + } + + moveProcess() { + if (this.isInRange()) { + this.target = pacman; + } else { + this.target = randomTargetsForGhosts[this.randomTargetIndex]; + } + this.changeDirectionIfPossible(); + this.moveForwards(); + if (this.checkCollisions()) { + this.moveBackwards(); + return; + } + } + + moveBackwards() { + switch (this.direction) { + case 4: + this.x -= this.speed; + break; + case 3: + this.y += this.speed; + break; + case 2: + this.x += this.speed; + break; + case 1: + this.y -= this.speed; + break; + } + } + + moveForwards() { + switch (this.direction) { + case 4: + this.x += this.speed; + break; + case 3: this.y -= this.speed; + break; + case 2: + this.x -= this.speed; + break; + case 1: + this.y += this.speed; + break; + } + } + + checkCollisions() { + let isCollided = false; + if ( + map[parseInt(this.y / oneBlockSize)][ + parseInt(this.x / oneBlockSize) + ] == 1 || + map[parseInt(this.y / oneBlockSize + 0.9999)][ + parseInt(this.x / oneBlockSize) + ] == 1 || + map[parseInt(this.y / oneBlockSize)][ + parseInt(this.x / oneBlockSize + 0.9999) + ] == 1 || + map[parseInt(this.y / oneBlockSize + 0.9999)][ + parseInt(this.x / oneBlockSize + 0.9999) + ] == 1 + ) { + isCollided = true; + } + return isCollided; + } + + changeDirectionIfPossible() { + let tempDirection = this.direction; + this.direction = this.calculateNewDirection( + map, + parseInt(this.target.x / oneBlockSize), + parseInt(this.target.y / oneBlockSize) + ); + if (typeof this.direction == "undefined") { + this.direction = tempDirection; + return; + } + if ( + this.getMapY() != this.getMapYRightSide() && + (this.direction == DIRECTION_LEFT || + this.direction == DIRECTION_RIGHT) + ) { + this.direction = DIRECTION_UP; + } + if ( + this.getMapX() != this.getMapXRightSide() && + this.direction == DIRECTION_UP + ) { + this.direction = DIRECTION_LEFT; + } + this.moveForwards(); + if (this.checkCollisions()) { + this.moveBackwards(); + this.direction = tempDirection; + } else { + this.moveBackwards(); + } + } + + calculateNewDirection(map, destX, destY) { + let mp = []; + for (let i = 0; i < map.length; i++) { + mp[i] = map[i].slice(); + } + + let queue = [ + { + x: this.getMapX(), + y: this.getMapY(), + rightX: this.getMapXRightSide(), + rightY: this.getMapYRightSide(), + moves: [], + }, + ]; + while (queue.length > 0) { + let poped = queue.shift(); + if (poped.x == destX && poped.y == destY) { + return poped.moves[0]; + } else { + mp[poped.y][poped.x] = 1; + let neighborList = this.addNeighbors(poped, mp); + for (let i = 0; i < neighborList.length; i++) { + queue.push(neighborList[i]); + } + } + } + + return 1; + } + + addNeighbors(poped, mp) { + let queue = []; + let numOfRows = mp.length; + let numOfColumns = mp[0].length; + + if ( + poped.x - 1 >= 0 && + poped.x - 1 < numOfRows && + mp[poped.y][poped.x - 1] != 1 + ) { + let tempMoves = poped.moves.slice(); + tempMoves.push(DIRECTION_LEFT); + queue.push({ x: poped.x - 1, y: poped.y, moves: tempMoves }); + } + if ( + poped.x + 1 >= 0 && + poped.x + 1 < numOfRows && + mp[poped.y][poped.x + 1] != 1 + ) { + let tempMoves = poped.moves.slice(); + tempMoves.push(DIRECTION_RIGHT); + queue.push({ x: poped.x + 1, y: poped.y, moves: tempMoves }); + } + if ( + poped.y - 1 >= 0 && + poped.y - 1 < numOfColumns && + mp[poped.y - 1][poped.x] != 1 + ) { + let tempMoves = poped.moves.slice(); + tempMoves.push(DIRECTION_UP); + queue.push({ x: poped.x, y: poped.y - 1, moves: tempMoves }); + } + if ( + poped.y + 1 >= 0 && + poped.y + 1 < numOfColumns && + mp[poped.y + 1][poped.x] != 1 + ) { + let tempMoves = poped.moves.slice(); + tempMoves.push(DIRECTION_BOTTOM); + queue.push({ x: poped.x, y: poped.y + 1, moves: tempMoves }); + } + return queue; + } + + getMapX() { + let mapX = parseInt(this.x / oneBlockSize); + return mapX; + } + + getMapY() { + let mapY = parseInt(this.y / oneBlockSize); + return mapY; + } + + getMapXRightSide() { + let mapX = parseInt((this.x * 0.99 + oneBlockSize) / oneBlockSize); + return mapX; + } + + getMapYRightSide() { + let mapY = parseInt((this.y * 0.99 + oneBlockSize) / oneBlockSize); + return mapY; + } + + changeAnimation() { + this.currentFrame = + this.currentFrame == this.frameCount ? 1 : this.currentFrame + 1; + } + + draw() { + canvasContext.save(); + canvasContext.drawImage( + ghostFrames, + this.imageX, + this.imageY, + this.imageWidth, + this.imageHeight, + this.x, + this.y, + this.width, + this.height + ); + canvasContext.restore(); + } +} + +let updateGhosts = () => { + for (let i = 0; i < ghosts.length; i++) { + ghosts[i].moveProcess(); + } +}; + +let drawGhosts = () => { + for (let i = 0; i < ghosts.length; i++) { + ghosts[i].draw(); + } +}; \ No newline at end of file diff --git a/pacman/ghost.png b/pacman/ghost.png new file mode 100644 index 0000000..7ea3e97 Binary files /dev/null and b/pacman/ghost.png differ diff --git a/pacman/index.html b/pacman/index.html new file mode 100644 index 0000000..8f9d30b --- /dev/null +++ b/pacman/index.html @@ -0,0 +1,22 @@ + + + + + + + + Pacman + + + + +
    + + +
    + + + + + + \ No newline at end of file diff --git a/pacman/script.js b/pacman/script.js new file mode 100644 index 0000000..3432d9a --- /dev/null +++ b/pacman/script.js @@ -0,0 +1,172 @@ +class Pacman { + constructor(x, y, width, height, speed) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.speed = speed; + this.direction = 4; + this.nextDirection = 4; + this.frameCount = 7; + this.currentFrame = 1; + setInterval(() => { + this.changeAnimation(); + }, 100); + } + + moveProcess() { + this.changeDirectionIfPossible(); + this.moveForwards(); + if (this.checkCollisions()) { + this.moveBackwards(); + return; + } + } + + eat() { + for (let i = 0; i < map.length; i++) { + for (let j = 0; j < map[0].length; j++) { + if ( + map[i][j] == 2 && + this.getMapX() == j && + this.getMapY() == i + ) { + map[i][j] = 3; + score++; + } + } + } + } + + moveBackwards() { + switch (this.direction) { + case DIRECTION_RIGHT: + this.x -= this.speed; + break; + case DIRECTION_UP: + this.y += this.speed; + break; + case DIRECTION_LEFT: + this.x += this.speed; + break; + case DIRECTION_BOTTOM: + this.y -= this.speed; + break; + } + } + + moveForwards() { + switch (this.direction) { + case DIRECTION_RIGHT: + this.x += this.speed; + break; + case DIRECTION_UP: + this.y -= this.speed; + break; + case DIRECTION_LEFT: + this.x -= this.speed; + break; + case DIRECTION_BOTTOM: + this.y += this.speed; + break; + } + } + + checkCollisions() { + let isCollided = false; + if ( + map[parseInt(this.y / oneBlockSize)][ + parseInt(this.x / oneBlockSize) + ] == 1 || + map[parseInt(this.y / oneBlockSize + 0.9999)][ + parseInt(this.x / oneBlockSize) + ] == 1 || + map[parseInt(this.y / oneBlockSize)][ + parseInt(this.x / oneBlockSize + 0.9999) + ] == 1 || + map[parseInt(this.y / oneBlockSize + 0.9999)][ + parseInt(this.x / oneBlockSize + 0.9999) + ] == 1 + ) { + isCollided = true; + } + return isCollided; + } + + checkGhostCollision(ghosts) { + for (let i = 0; i < ghosts.length; i++) { + let ghost = ghosts[i]; + if ( + ghost.getMapX() == this.getMapX() && + ghost.getMapY() == this.getMapY() + ) { + return true; + } + } + return false; + } + + changeDirectionIfPossible() { + if (this.direction == this.nextDirection) return; + let tempDirection = this.direction; + this.direction = this.nextDirection; + this.moveForwards(); + if (this.checkCollisions()) { + this.moveBackwards(); + this.direction = tempDirection; + } else { + this.moveBackwards(); + } + } + + getMapX() { + let mapX = parseInt(this.x / oneBlockSize); + return mapX; + } + + getMapY() { + let mapY = parseInt(this.y / oneBlockSize); + + return mapY; + } + + getMapXRightSide() { + let mapX = parseInt((this.x * 0.99 + oneBlockSize) / oneBlockSize); + return mapX; + } + + getMapYRightSide() { + let mapY = parseInt((this.y * 0.99 + oneBlockSize) / oneBlockSize); + return mapY; + } + + changeAnimation() { + this.currentFrame = + this.currentFrame == this.frameCount ? 1 : this.currentFrame + 1; + } + + draw() { + canvasContext.save(); + canvasContext.translate( + this.x + oneBlockSize / 2, + this.y + oneBlockSize / 2 + ); + canvasContext.rotate((this.direction * 90 * Math.PI) / 180); + canvasContext.translate( + -this.x - oneBlockSize / 2, + -this.y - oneBlockSize / 2 + ); + canvasContext.drawImage( + pacmanFrames, + (this.currentFrame - 1) * oneBlockSize, + 0, + oneBlockSize, + oneBlockSize, + this.x, + this.y, + this.width, + this.height + ); + canvasContext.restore(); + } +} \ No newline at end of file diff --git a/pacman/style.css b/pacman/style.css new file mode 100644 index 0000000..010f63e --- /dev/null +++ b/pacman/style.css @@ -0,0 +1,8 @@ +*{ + margin: 0; + padding: 0;background-color: black; +} + +.assets{ + display: none; +} \ No newline at end of file