Best JavaScript code snippet using wpt
galleryFunctions.js
Source:galleryFunctions.js
1function onWindowResize() {2 camera.aspect = window.innerWidth / window.innerHeight;3 camera.updateProjectionMatrix();4 renderer.setSize(window.innerWidth, window.innerHeight);5}67function initCannon() {8 world = new CANNON.World();9 world.quatNormalizeSkip = 0;10 world.quatNormalizeFast = false;1112 var solver = new CANNON.GSSolver();1314 world.defaultContactMaterial.contactEquationStiffness = 1e9;15 world.defaultContactMaterial.contactEquationRelaxation = 4;1617 solver.iterations = 7;18 solver.tolerance = 0.1;19 var split = true;20 if (split) world.solver = new CANNON.SplitSolver(solver);21 else world.solver = solver;2223 world.gravity.set(0, -20, 0);24 world.broadphase = new CANNON.NaiveBroadphase();2526 // Create a slippery material (friction coefficient = 0.0)27 physicsMaterial = new CANNON.Material("slipperyMaterial");28 var physicsContactMaterial = new CANNON.ContactMaterial(29 physicsMaterial,30 physicsMaterial,31 0.0,32 0.333 );34 // We must add the contact materials to the world35 world.addContactMaterial(physicsContactMaterial);3637 // Create a sphere38 var mass = 2,39 radius = 0.5;4041 sphereShape = new CANNON.Sphere(radius);42 sphereBody = new CANNON.Body({ mass: mass });43 sphereBody.addShape(sphereShape);44 sphereBody.position.set(-10, 1, 1);45 sphereBody.linearDamping = 0.9;46 world.add(sphereBody);4748 // Create a plane49 var groundShape = new CANNON.Plane();50 var groundBody = new CANNON.Body({ mass: 0 });51 groundBody.addShape(groundShape);52 groundBody.quaternion.setFromAxisAngle(53 new CANNON.Vec3(1, 0, 0),54 -Math.PI / 255 );56 world.add(groundBody);57}5859function animate() {60 requestAnimationFrame(animate);6162 if (controls.enabled) {63 world.step(dt);6465 // Update ball positions66 for (var i = 0; i < balls.length; i++) {67 ballMeshes[i].position.copy(balls[i].position);68 ballMeshes[i].quaternion.copy(balls[i].quaternion);69 }7071 // Update box positions72 for (var i = 0; i < boxes.length; i++) {73 boxMeshes[i].position.copy(boxes[i].position);74 boxMeshes[i].quaternion.copy(boxes[i].quaternion);75 }76 }7778 controls.update(Date.now() - time);79 renderer.render(scene, camera);80 time = Date.now();81}8283function addLights() {84 light3 = new THREE.SpotLight(0xffffff);85 light3.position.set(10, 30, 20);86 light3.target.position.set(0, 0, 0);87 if (true) {88 light3.castShadow = true;89 light3.shadowCameraNear = 20;90 light3.shadowCameraFar = 50;91 light3.shadowCameraFov = 40;92 light3.shadowMapBias = 0.1;93 light3.shadowMapDarkness = 0.7;94 light3.shadowMapWidth = 2 * 512;95 light3.shadowMapHeight = 2 * 512;96 }97 scene.add(light3);9899 light2 = new THREE.SpotLight(0xffffff);100 light2.position.set(5, -100, 0);101 light2.target.position.set(0, 0, 0);102 if (true) {103 light2.castShadow = true;104 light2.shadowCameraNear = 20;105 light2.shadowCameraFar = 50;106 light2.shadowCameraFov = 40;107 light2.shadowMapBias = 0.1;108 light2.shadowMapDarkness = 0.99;109 light2.shadowMapWidth = 2 * 512;110 light2.shadowMapHeight = 2 * 512;111 }112 scene.add(light2);113114 lightTOP = new THREE.SpotLight(0xffffff);115 lightTOP.position.set(5, 100, 0);116 lightTOP.target.position.set(0, 0, 0);117 if (true) {118 lightTOP.castShadow = true;119 lightTOP.shadowCameraNear = 20;120 lightTOP.shadowCameraFar = 50;121 lightTOP.shadowCameraFov = 40;122 lightTOP.shadowMapBias = 0.1;123 lightTOP.shadowMapDarkness = 0.99;124 lightTOP.shadowMapWidth = 2 * 512;125 lightTOP.shadowMapHeight = 2 * 512;126 }127 scene.add(lightTOP);128129 lightRIGHT = new THREE.SpotLight(0x888888);130 lightRIGHT.position.set(5, 0, 100);131 lightRIGHT.target.position.set(0, 0, 0);132 if (true) {133 lightRIGHT.castShadow = true;134 lightRIGHT.shadowCameraNear = 20;135 lightRIGHT.shadowCameraFar = 50;136 lightRIGHT.shadowCameraFov = 40;137 lightRIGHT.shadowMapBias = 0.1;138 lightRIGHT.shadowMapDarkness = 0.99;139 lightRIGHT.shadowMapWidth = 2 * 512;140 lightRIGHT.shadowMapHeight = 2 * 512;141 }142 scene.add(lightRIGHT);143144 lightLEFT = new THREE.SpotLight(0x888888);145 lightLEFT.position.set(5, 0, -100);146 lightLEFT.target.position.set(0, 0, 0);147 if (true) {148 lightLEFT.castShadow = true;149 lightLEFT.shadowCameraNear = 20;150 lightLEFT.shadowCameraFar = 50;151 lightLEFT.shadowCameraFov = 40;152 lightLEFT.shadowMapBias = 0.1;153 lightLEFT.shadowMapDarkness = 0.99;154 lightLEFT.shadowMapWidth = 2 * 512;155 lightLEFT.shadowMapHeight = 2 * 512;156 }157 scene.add(lightLEFT);158159 lightBack = new THREE.SpotLight(0x888888);160 lightBack.position.set(100, 0, 0);161 lightBack.target.position.set(0, 0, 0);162 if (true) {163 lightBack.castShadow = true;164 lightBack.shadowCameraNear = 20;165 lightBack.shadowCameraFar = 50;166 lightBack.shadowCameraFov = 40;167 lightBack.shadowMapBias = 0.1;168 lightBack.shadowMapDarkness = 0.99;169 lightBack.shadowMapWidth = 2 * 512;170 lightBack.shadowMapHeight = 2 * 512;171 }172 scene.add(lightBack);173174 lightFront = new THREE.SpotLight(0xd1dcdf);175 lightFront.position.set(-100, 0, 0);176 lightFront.target.position.set(0, 0, 0);177 if (true) {178 lightFront.castShadow = true;179 lightFront.shadowCameraNear = 20;180 lightFront.shadowCameraFar = 50;181 lightFront.shadowCameraFov = 40;182 lightFront.shadowMapBias = 0.1;183 lightFront.shadowMapDarkness = 0.99;184 lightFront.shadowMapWidth = 2 * 512;185 lightFront.shadowMapHeight = 2 * 512;186 }187 scene.add(lightFront);188}189190function addWall(material, x, y, z, x_axis, y_axis, z_axis, rotate) {191 var halfExtents = new CANNON.Vec3(x_axis, y_axis, z_axis);192 var boxShape = new CANNON.Box(halfExtents);193 var boxGeometry = new THREE.BoxGeometry(194 halfExtents.x * 2,195 halfExtents.y * 2,196 halfExtents.z * 2197 );198199 var boxBody = new CANNON.Body({ mass: 0 });200 boxBody.addShape(boxShape);201 var boxMesh = new THREE.Mesh(boxGeometry, material);202 world.add(boxBody);203 scene.add(boxMesh);204 boxBody.position.set(x, y, z);205 boxMesh.position.set(x, y, z);206 boxMesh.castShadow = false;207 boxMesh.receiveShadow = false;208 boxes.push(boxBody);209 boxMeshes.push(boxMesh);210}211212function addNewFloors(count) {213 material_wall = new THREE.MeshPhongMaterial({ color: 0x88888 });214 material_floor = new THREE.MeshPhongMaterial({ color: 0x000 });215 material_ceiling = new THREE.MeshPhongMaterial({ color: 0x9d7bd1 });216217 for (var i = 0; i < count; i++) {218 addWall(219 material_wall,220 (x = 0),221 (y = i * 2 + 3),222 (z = 0),223 (x_axis = 5),224 (y_axis = 1),225 (z_axis = 0.05)226 );227 addWall(228 material_wall,229 (x = -3),230 (y = i * 2 + 3),231 (z = 1),232 (x_axis = 0.05),233 (y_axis = 1),234 (z_axis = 1)235 );236 addWall(237 material_wall,238 (x = -3),239 (y = i * 2 + 3),240 (z = 4),241 (x_axis = 0.05),242 (y_axis = 1),243 (z_axis = 1)244 );245 addWall(246 material_wall,247 (x = -3),248 (y = i * 2 + 3.8),249 (z = 2.5),250 (x_axis = 0.05),251 (y_axis = 0.2),252 (z_axis = 0.5)253 );254 addWall(255 material_wall,256 (x = 0),257 (y = i * 2 + 3),258 (z = 5),259 (x_axis = 5),260 (y_axis = 1),261 (z_axis = 0.05)262 );263 addWall(264 material_wall,265 (x = -5),266 (y = i * 2 + 2.25),267 (z = 2.5),268 (x_axis = 0.05),269 (y_axis = 0.3),270 (z_axis = 2.5)271 );272 addWall(273 material_wall,274 (x = 5),275 (y = i * 2 + 3),276 (z = 1),277 (x_axis = 0.05),278 (y_axis = 1),279 (z_axis = 1)280 );281 addWall(282 material_wall,283 (x = 5),284 (y = i * 2 + 3),285 (z = 4),286 (x_axis = 0.05),287 (y_axis = 1),288 (z_axis = 1)289 );290 addWall(291 material_wall,292 (x = 5),293 (y = i * 2 + 3.8),294 (z = 2.5),295 (x_axis = 0.05),296 (y_axis = 0.2),297 (z_axis = 0.5)298 );299 addWall(300 material_wall,301 (x = -5),302 (y = i * 2 + 3),303 (z = 6.45),304 (x_axis = 0.05),305 (y_axis = 1),306 (z_axis = 1.5)307 );308 addWall(309 material_wall,310 (x = -4.05),311 (y = i * 2 + 3),312 (z = 8),313 (x_axis = 1),314 (y_axis = 1),315 (z_axis = 0.05)316 );317 addWall(318 material_wall,319 (x = -3),320 (y = i * 2 + 3),321 (z = 9.95),322 (x_axis = 0.05),323 (y_axis = 1),324 (z_axis = 2)325 );326 addWall(327 material_wall,328 (x = -1.25),329 (y = i * 2 + 3),330 (z = 12),331 (x_axis = 1.8),332 (y_axis = 1),333 (z_axis = 0.05)334 );335 addWall(336 material_wall,337 (x = -3),338 (y = i * 2 + 3),339 (z = 14.5),340 (x_axis = 0.05),341 (y_axis = 1),342 (z_axis = 2.5)343 );344 addWall(345 material_wall,346 (x = 3.25),347 (y = i * 2 + 3),348 (z = 12),349 (x_axis = 1.7),350 (y_axis = 1),351 (z_axis = 0.05)352 );353 addWall(354 material_wall,355 (x = 1.05),356 (y = i * 2 + 3.8),357 (z = 12),358 (x_axis = 0.5),359 (y_axis = 0.2),360 (z_axis = 0.05)361 );362 addWall(363 material_wall,364 (x = 5),365 (y = i * 2 + 3),366 (z = 7),367 (x_axis = 0.05),368 (y_axis = 1),369 (z_axis = 2)370 );371 addWall(372 material_wall,373 (x = 5),374 (y = i * 2 + 3),375 (z = 11),376 (x_axis = 0.05),377 (y_axis = 1),378 (z_axis = 1)379 );380 addWall(381 material_wall,382 (x = 5),383 (y = i * 2 + 3.8),384 (z = 9.5),385 (x_axis = 0.05),386 (y_axis = 0.2),387 (z_axis = 0.5)388 );389 addWall(390 material_wall,391 (x = 0.95),392 (y = i * 2 + 3),393 (z = 17),394 (x_axis = 4),395 (y_axis = 1),396 (z_axis = 0.05)397 );398 addWall(399 material_wall,400 (x = 5),401 (y = i * 2 + 3),402 (z = 14.5),403 (x_axis = 0.05),404 (y_axis = 1),405 (z_axis = 2.55)406 );407 addWall(408 material_wall,409 (x = -5),410 (y = i * 2 + 3),411 (z = -1.45),412 (x_axis = 0.05),413 (y_axis = 1),414 (z_axis = 1.5)415 );416 addWall(417 material_wall,418 (x = -4.05),419 (y = i * 2 + 3),420 (z = -2.95),421 (x_axis = 1),422 (y_axis = 1),423 (z_axis = 0.05)424 );425 addWall(426 material_wall,427 (x = -3),428 (y = i * 2 + 3),429 (z = -6),430 (x_axis = 0.05),431 (y_axis = 1),432 (z_axis = 3.1)433 );434 addWall(435 material_wall,436 (x = 5),437 (y = i * 2 + 3),438 (z = -2),439 (x_axis = 0.05),440 (y_axis = 1),441 (z_axis = 2)442 );443 addWall(444 material_wall,445 (x = 5),446 (y = i * 2 + 3),447 (z = -7),448 (x_axis = 0.05),449 (y_axis = 1),450 (z_axis = 2)451 );452 addWall(453 material_wall,454 (x = 5),455 (y = i * 2 + 3.8),456 (z = -4.5),457 (x_axis = 0.05),458 (y_axis = 0.2),459 (z_axis = 0.5)460 );461 addWall(462 material_wall,463 (x = -1.25),464 (y = i * 2 + 3),465 (z = -9.05),466 (x_axis = 1.8),467 (y_axis = 1),468 (z_axis = 0.05)469 );470 addWall(471 material_wall,472 (x = 3.25),473 (y = i * 2 + 3),474 (z = -9.05),475 (x_axis = 1.7),476 (y_axis = 1),477 (z_axis = 0.05)478 );479 addWall(480 material_wall,481 (x = 1.05),482 (y = i * 2 + 3.8),483 (z = -9.05),484 (x_axis = 0.5),485 (y_axis = 0.2),486 (z_axis = 0.05)487 );488 addWall(489 material_wall,490 (x = -3),491 (y = i * 2 + 3),492 (z = -10.5),493 (x_axis = 0.05),494 (y_axis = 1),495 (z_axis = 1.5)496 );497 addWall(498 material_wall,499 (x = 1),500 (y = i * 2 + 3),501 (z = -11.95),502 (x_axis = 4),503 (y_axis = 1),504 (z_axis = 0.05)505 );506 addWall(507 material_wall,508 (x = 5),509 (y = i * 2 + 3),510 (z = -10.5),511 (x_axis = 0.05),512 (y_axis = 1),513 (z_axis = 1.5)514 );515 addWall(516 material_wall,517 (x = -3.7),518 (y = i * 2 + 3),519 (z = -11.95),520 (x_axis = 0.7),521 (y_axis = 1),522 (z_axis = 0.05)523 );524 addWall(525 material_wall,526 (x = -4.4),527 (y = i * 2 + 3),528 (z = -14.4),529 (x_axis = 0.05),530 (y_axis = 1),531 (z_axis = 2.5)532 );533 addWall(534 material_wall,535 (x = -1.95),536 (y = i * 2 + 3),537 (z = -16.9),538 (x_axis = 2.5),539 (y_axis = 1),540 (z_axis = 0.05)541 );542 addWall(543 material_wall,544 (x = 0.55),545 (y = i * 2 + 3),546 (z = -15.95),547 (x_axis = 0.05),548 (y_axis = 1),549 (z_axis = 1)550 );551 addWall(552 material_wall,553 (x = 4),554 (y = i * 2 + 3),555 (z = -12.5),556 (x_axis = 0.05),557 (y_axis = 1),558 (z_axis = 0.5)559 );560 addWall(561 material_wall,562 (x = 4),563 (y = i * 2 + 3),564 (z = -14.5),565 (x_axis = 0.05),566 (y_axis = 1),567 (z_axis = 0.5)568 );569 addWall(570 material_wall,571 (x = 4),572 (y = i * 2 + 3.8),573 (z = -13.5),574 (x_axis = 0.05),575 (y_axis = 0.2),576 (z_axis = 0.5)577 );578 addWall(579 material_wall,580 (x = 2.3),581 (y = i * 2 + 3),582 (z = -15),583 (x_axis = 1.75),584 (y_axis = 1),585 (z_axis = 0.05)586 );587 addWall(588 material_wall,589 (x = 5.8),590 (y = i * 2 + 3),591 (z = -15),592 (x_axis = 1.75),593 (y_axis = 1),594 (z_axis = 0.05)595 );596 addWall(597 material_wall,598 (x = 6.8),599 (y = i * 2 + 3),600 (z = -9.05),601 (x_axis = 0.7),602 (y_axis = 1),603 (z_axis = 0.05)604 );605 addWall(606 material_wall,607 (x = 5.5),608 (y = i * 2 + 3.8),609 (z = -9.05),610 (x_axis = 0.6),611 (y_axis = 0.2),612 (z_axis = 0.05)613 );614 addWall(615 material_wall,616 (x = 7.5),617 (y = i * 2 + 3),618 (z = -7),619 (x_axis = 0.05),620 (y_axis = 1),621 (z_axis = 2.1)622 );623 addWall(624 material_wall,625 (x = 7.5),626 (y = i * 2 + 3),627 (z = -12),628 (x_axis = 0.05),629 (y_axis = 1),630 (z_axis = 3)631 );632 addWall(633 material_wall,634 (x = 10.5),635 (y = i * 2 + 3),636 (z = -9.05),637 (x_axis = 3),638 (y_axis = 1),639 (z_axis = 0.05)640 );641 addWall(642 material_wall,643 (x = 13.5),644 (y = i * 2 + 3),645 (z = -5.6),646 (x_axis = 0.05),647 (y_axis = 1),648 (z_axis = 3.5)649 );650 addWall(651 material_wall,652 (x = 8),653 (y = i * 2 + 3),654 (z = -2.1),655 (x_axis = 0.5),656 (y_axis = 1),657 (z_axis = 0.05)658 );659 addWall(660 material_wall,661 (x = 9),662 (y = i * 2 + 3.8),663 (z = -2.1),664 (x_axis = 0.5),665 (y_axis = 0.2),666 (z_axis = 0.05)667 );668 addWall(669 material_wall,670 (x = 11.5),671 (y = i * 2 + 3),672 (z = -2.1),673 (x_axis = 2),674 (y_axis = 1),675 (z_axis = 0.05)676 );677 addWall(678 material_wall,679 (x = 7.5),680 (y = i * 2 + 3),681 (z = -2.95),682 (x_axis = 0.05),683 (y_axis = 1),684 (z_axis = 0.9)685 );686 addWall(687 material_wall,688 (x = 7.5),689 (y = i * 2 + 3.8),690 (z = -4.4),691 (x_axis = 0.05),692 (y_axis = 0.2),693 (z_axis = 0.55)694 );695 addWall(696 material_wall,697 (x = 7.5),698 (y = i * 2 + 3),699 (z = -0.05),700 (x_axis = 0.05),701 (y_axis = 1),702 (z_axis = 2)703 );704 addWall(705 material_wall,706 (x = 7.5),707 (y = i * 2 + 3),708 (z = 5.1),709 (x_axis = 0.05),710 (y_axis = 1),711 (z_axis = 2.1)712 );713 addWall(714 material_wall,715 (x = 7.5),716 (y = i * 2 + 3.8),717 (z = 2.45),718 (x_axis = 0.05),719 (y_axis = 0.2),720 (z_axis = 0.55)721 );722 addWall(723 material_wall,724 (x = 8),725 (y = i * 2 + 3),726 (z = 7.15),727 (x_axis = 0.5),728 (y_axis = 1),729 (z_axis = 0.05)730 );731 addWall(732 material_wall,733 (x = 9),734 (y = i * 2 + 3.8),735 (z = 7.15),736 (x_axis = 0.5),737 (y_axis = 0.2),738 (z_axis = 0.05)739 );740 addWall(741 material_wall,742 (x = 11.5),743 (y = i * 2 + 3),744 (z = 7.15),745 (x_axis = 2),746 (y_axis = 1),747 (z_axis = 0.05)748 );749 addWall(750 material_wall,751 (x = 13.5),752 (y = i * 2 + 3),753 (z = 2.5),754 (x_axis = 0.05),755 (y_axis = 1),756 (z_axis = 4.7)757 );758 addWall(759 material_wall,760 (x = 7.5),761 (y = i * 2 + 3),762 (z = 8.1),763 (x_axis = 0.05),764 (y_axis = 1),765 (z_axis = 0.9)766 );767 addWall(768 material_wall,769 (x = 7.5),770 (y = i * 2 + 3.8),771 (z = 9.55),772 (x_axis = 0.05),773 (y_axis = 0.2),774 (z_axis = 0.55)775 );776 addWall(777 material_wall,778 (x = 7.5),779 (y = i * 2 + 3),780 (z = 12.1),781 (x_axis = 0.05),782 (y_axis = 1),783 (z_axis = 2)784 );785 addWall(786 material_wall,787 (x = 10.6),788 (y = i * 2 + 3),789 (z = 15.55),790 (x_axis = 0.05),791 (y_axis = 1),792 (z_axis = 1.5)793 );794 addWall(795 material_wall,796 (x = 13.5),797 (y = i * 2 + 3),798 (z = 10.6),799 (x_axis = 0.05),800 (y_axis = 1),801 (z_axis = 3.5)802 );803 addWall(804 material_wall,805 (x = 10.5),806 (y = i * 2 + 3),807 (z = 14.05),808 (x_axis = 3),809 (y_axis = 1),810 (z_axis = 0.05)811 );812 addWall(813 material_wall,814 (x = 7.8),815 (y = i * 2 + 3),816 (z = 17),817 (x_axis = 2.8),818 (y_axis = 1),819 (z_axis = 0.05)820 );821 addWall(822 material_wall,823 (x = 6.8),824 (y = i * 2 + 3),825 (z = 14.05),826 (x_axis = 0.65),827 (y_axis = 1),828 (z_axis = 0.05)829 );830 addWall(831 material_wall,832 (x = 5.6),833 (y = i * 2 + 3.8),834 (z = 14.05),835 (x_axis = 0.6),836 (y_axis = 0.2),837 (z_axis = 0.05)838 );839 addWall(840 material_wall,841 (x = 6.7),842 (y = i * 2 + 2.015),843 (z = 16.25),844 (x_axis = 0.15),845 (y_axis = 0.01),846 (z_axis = 0.75)847 );848 addWall(849 material_wall,850 (x = 7),851 (y = i * 2 + 2.05),852 (z = 16.25),853 (x_axis = 0.15),854 (y_axis = 0.05),855 (z_axis = 0.75)856 );857 addWall(858 material_wall,859 (x = 7.3),860 (y = i * 2 + 2.15),861 (z = 16.25),862 (x_axis = 0.15),863 (y_axis = 0.05),864 (z_axis = 0.75)865 );866 addWall(867 material_wall,868 (x = 7.6),869 (y = i * 2 + 2.25),870 (z = 16.25),871 (x_axis = 0.15),872 (y_axis = 0.05),873 (z_axis = 0.75)874 );875 addWall(876 material_wall,877 (x = 7.9),878 (y = i * 2 + 2.35),879 (z = 16.25),880 (x_axis = 0.15),881 (y_axis = 0.05),882 (z_axis = 0.75)883 );884 addWall(885 material_wall,886 (x = 8.2),887 (y = i * 2 + 2.45),888 (z = 16.25),889 (x_axis = 0.15),890 (y_axis = 0.05),891 (z_axis = 0.75)892 );893 addWall(894 material_wall,895 (x = 8.5),896 (y = i * 2 + 2.55),897 (z = 16.25),898 (x_axis = 0.15),899 (y_axis = 0.05),900 (z_axis = 0.75)901 );902 addWall(903 material_wall,904 (x = 8.8),905 (y = i * 2 + 2.65),906 (z = 16.25),907 (x_axis = 0.15),908 (y_axis = 0.05),909 (z_axis = 0.75)910 );911 addWall(912 material_wall,913 (x = 9.1),914 (y = i * 2 + 2.75),915 (z = 16.25),916 (x_axis = 0.15),917 (y_axis = 0.05),918 (z_axis = 0.75)919 );920 addWall(921 material_wall,922 (x = 9.4),923 (y = i * 2 + 2.85),924 (z = 16.25),925 (x_axis = 0.15),926 (y_axis = 0.05),927 (z_axis = 0.75)928 );929 addWall(930 material_wall,931 (x = 10.05),932 (y = i * 2 + 2.95),933 (z = 15.5),934 (x_axis = 0.5),935 (y_axis = 0.05),936 (z_axis = 1.5)937 );938 addWall(939 material_wall,940 (x = 9.4),941 (y = i * 2 + 3.05),942 (z = 14.75),943 (x_axis = 0.15),944 (y_axis = 0.05),945 (z_axis = 0.75)946 );947 addWall(948 material_wall,949 (x = 9.1),950 (y = i * 2 + 3.15),951 (z = 14.75),952 (x_axis = 0.15),953 (y_axis = 0.05),954 (z_axis = 0.75)955 );956 addWall(957 material_wall,958 (x = 8.8),959 (y = i * 2 + 3.25),960 (z = 14.75),961 (x_axis = 0.15),962 (y_axis = 0.05),963 (z_axis = 0.75)964 );965 addWall(966 material_wall,967 (x = 8.5),968 (y = i * 2 + 3.35),969 (z = 14.75),970 (x_axis = 0.15),971 (y_axis = 0.05),972 (z_axis = 0.75)973 );974 addWall(975 material_wall,976 (x = 8.2),977 (y = i * 2 + 3.45),978 (z = 14.75),979 (x_axis = 0.15),980 (y_axis = 0.05),981 (z_axis = 0.75)982 );983 addWall(984 material_wall,985 (x = 7.9),986 (y = i * 2 + 3.55),987 (z = 14.75),988 (x_axis = 0.15),989 (y_axis = 0.05),990 (z_axis = 0.75)991 );992 addWall(993 material_wall,994 (x = 7.6),995 (y = i * 2 + 3.65),996 (z = 14.75),997 (x_axis = 0.15),998 (y_axis = 0.05),999 (z_axis = 0.75)1000 );1001 addWall(1002 material_wall,1003 (x = 7.3),1004 (y = i * 2 + 3.75),1005 (z = 14.75),1006 (x_axis = 0.15),1007 (y_axis = 0.05),1008 (z_axis = 0.75)1009 );1010 addWall(1011 material_wall,1012 (x = 7),1013 (y = i * 2 + 3.85),1014 (z = 14.75),1015 (x_axis = 0.15),1016 (y_axis = 0.05),1017 (z_axis = 0.75)1018 );1019 addWall(1020 material_wall,1021 (x = 6.7),1022 (y = i * 2 + 3.95),1023 (z = 14.75),1024 (x_axis = 0.15),1025 (y_axis = 0.05),1026 (z_axis = 0.75)1027 );1028 addWall(1029 material_floor,1030 (x = -3.95),1031 (y = i * 2 + 2.01),1032 (z = 2.5),1033 (x_axis = 1),1034 (y_axis = 0.01),1035 (z_axis = 2.5)1036 );1037 addWall(1038 material_wall,1039 (x = -3.95),1040 (y = i * 2 + 1.96),1041 (z = 2.5),1042 (x_axis = 1),1043 (y_axis = 0.01),1044 (z_axis = 2.5)1045 );1046 addWall(1047 material_floor,1048 (x = 5.25),1049 (y = i * 2 + 2.01),1050 (z = 2.5),1051 (x_axis = 8.22),1052 (y_axis = 0.01),1053 (z_axis = 11.5)1054 );1055 addWall(1056 material_floor,1057 (x = 2.25),1058 (y = i * 2 + 2.01),1059 (z = -12),1060 (x_axis = 5.2),1061 (y_axis = 0.01),1062 (z_axis = 3)1063 );1064 addWall(1065 material_floor,1066 (x = -3.95),1067 (y = i * 2 + 2.01),1068 (z = -1.47),1069 (x_axis = 1),1070 (y_axis = 0.01),1071 (z_axis = 1.5)1072 );1073 addWall(1074 material_floor,1075 (x = -3.95),1076 (y = i * 2 + 2.01),1077 (z = 6.47),1078 (x_axis = 1),1079 (y_axis = 0.01),1080 (z_axis = 1.5)1081 );1082 addWall(1083 material_floor,1084 (x = 1.77),1085 (y = i * 2 + 2.01),1086 (z = 15.5),1087 (x_axis = 4.78),1088 (y_axis = 0.01),1089 (z_axis = 1.5)1090 );1091 addWall(1092 material_floor,1093 (x = -1.9),1094 (y = i * 2 + 2.01),1095 (z = -15.95),1096 (x_axis = 2.45),1097 (y_axis = 0.01),1098 (z_axis = 0.97)1099 );1100 addWall(1101 material_floor,1102 (x = -3.65),1103 (y = i * 2 + 2.01),1104 (z = -13.5),1105 (x_axis = 0.75),1106 (y_axis = 0.01),1107 (z_axis = 1.5)1108 );1109 addWall(1110 material_ceiling,1111 (x = 5.25),1112 (y = i * 2 + 3.99),1113 (z = 2.5),1114 (x_axis = 8.22),1115 (y_axis = 0.01),1116 (z_axis = 11.5)1117 );1118 addWall(1119 material_ceiling,1120 (x = 2.25),1121 (y = i * 2 + 3.99),1122 (z = -12),1123 (x_axis = 5.2),1124 (y_axis = 0.01),1125 (z_axis = 3)1126 );1127 addWall(1128 material_ceiling,1129 (x = -3.95),1130 (y = i * 2 + 3.99),1131 (z = -1.47),1132 (x_axis = 1),1133 (y_axis = 0.01),1134 (z_axis = 1.5)1135 );1136 addWall(1137 material_ceiling,1138 (x = -3.95),1139 (y = i * 2 + 3.99),1140 (z = 6.47),1141 (x_axis = 1),1142 (y_axis = 0.01),1143 (z_axis = 1.5)1144 );1145 addWall(1146 material_ceiling,1147 (x = 1.77),1148 (y = i * 2 + 3.99),1149 (z = 15.5),1150 (x_axis = 4.78),1151 (y_axis = 0.01),1152 (z_axis = 1.5)1153 );1154 addWall(1155 material_ceiling,1156 (x = -1.9),1157 (y = i * 2 + 3.99),1158 (z = -15.95),1159 (x_axis = 2.45),1160 (y_axis = 0.01),1161 (z_axis = 0.97)1162 );1163 addWall(1164 material_ceiling,1165 (x = -3.65),1166 (y = i * 2 + 3.99),1167 (z = -13.5),1168 (x_axis = 0.75),1169 (y_axis = 0.01),1170 (z_axis = 1.5)1171 );1172 addWall(1173 material_floor,1174 (x = 5.25),1175 (y = i * 2 + 4.01),1176 (z = 2.5),1177 (x_axis = 8.22),1178 (y_axis = 0.01),1179 (z_axis = 11.5)1180 );1181 addWall(1182 material_floor,1183 (x = 2.25),1184 (y = i * 2 + 4.01),1185 (z = -12),1186 (x_axis = 5.2),1187 (y_axis = 0.01),1188 (z_axis = 3)1189 );1190 addWall(1191 material_floor,1192 (x = -3.95),1193 (y = i * 2 + 4.01),1194 (z = -1.47),1195 (x_axis = 1),1196 (y_axis = 0.01),1197 (z_axis = 1.5)1198 );1199 addWall(1200 material_floor,1201 (x = -3.95),1202 (y = i * 2 + 4.01),1203 (z = 6.47),1204 (x_axis = 1),1205 (y_axis = 0.01),1206 (z_axis = 1.5)1207 );1208 addWall(1209 material_floor,1210 (x = 1.77),1211 (y = i * 2 + 4.01),1212 (z = 15.5),1213 (x_axis = 4.78),1214 (y_axis = 0.01),1215 (z_axis = 1.5)1216 );1217 addWall(1218 material_floor,1219 (x = -1.9),1220 (y = i * 2 + 4.01),1221 (z = -15.95),1222 (x_axis = 2.45),1223 (y_axis = 0.01),1224 (z_axis = 0.97)1225 );1226 addWall(1227 material_floor,1228 (x = -3.65),1229 (y = i * 2 + 4.01),1230 (z = -13.5),1231 (x_axis = 0.75),1232 (y_axis = 0.01),1233 (z_axis = 1.5)1234 );1235 }1236}12371238function addAllWalls() {1239 material_wall = new THREE.MeshPhongMaterial({ color: 0x88888 });1240 material_floor = new THREE.MeshPhongMaterial({ color: 0x005 });1241 material_ceiling = new THREE.MeshPhongMaterial({ color: 0x9d7bd1 });12421243 addWall(1244 material_wall,1245 (x = 0),1246 (y = 1),1247 (z = 0),1248 (x_axis = 5),1249 (y_axis = 1),1250 (z_axis = 0.05)1251 );1252 addWall(1253 material_wall,1254 (x = -3),1255 (y = 1),1256 (z = 1),1257 (x_axis = 0.05),1258 (y_axis = 1),1259 (z_axis = 1)1260 );1261 addWall(1262 material_wall,1263 (x = -3),1264 (y = 1),1265 (z = 4),1266 (x_axis = 0.05),1267 (y_axis = 1),1268 (z_axis = 1)1269 );1270 addWall(1271 material_wall,1272 (x = -3),1273 (y = 1.8),1274 (z = 2.5),1275 (x_axis = 0.05),1276 (y_axis = 0.2),1277 (z_axis = 0.5)1278 );1279 addWall(1280 material_wall,1281 (x = 0),1282 (y = 1),1283 (z = 5),1284 (x_axis = 5),1285 (y_axis = 1),1286 (z_axis = 0.05)1287 );1288 addWall(1289 material_wall,1290 (x = 5),1291 (y = 1),1292 (z = 1),1293 (x_axis = 0.05),1294 (y_axis = 1),1295 (z_axis = 1)1296 );1297 addWall(1298 material_wall,1299 (x = 5),1300 (y = 1),1301 (z = 4),1302 (x_axis = 0.05),1303 (y_axis = 1),1304 (z_axis = 1)1305 );1306 addWall(1307 material_wall,1308 (x = 5),1309 (y = 1.8),1310 (z = 2.5),1311 (x_axis = 0.05),1312 (y_axis = 0.2),1313 (z_axis = 0.5)1314 );1315 addWall(1316 material_wall,1317 (x = -5),1318 (y = 1),1319 (z = 6.45),1320 (x_axis = 0.05),1321 (y_axis = 1),1322 (z_axis = 1.5)1323 );1324 addWall(1325 material_wall,1326 (x = -4.05),1327 (y = 1),1328 (z = 8),1329 (x_axis = 1),1330 (y_axis = 1),1331 (z_axis = 0.05)1332 );1333 addWall(1334 material_wall,1335 (x = -3),1336 (y = 1),1337 (z = 9.95),1338 (x_axis = 0.05),1339 (y_axis = 1),1340 (z_axis = 2)1341 );1342 addWall(1343 material_wall,1344 (x = -1.25),1345 (y = 1),1346 (z = 12),1347 (x_axis = 1.8),1348 (y_axis = 1),1349 (z_axis = 0.05)1350 );1351 addWall(1352 material_wall,1353 (x = -3),1354 (y = 1),1355 (z = 14.5),1356 (x_axis = 0.05),1357 (y_axis = 1),1358 (z_axis = 2.5)1359 );1360 addWall(1361 material_wall,1362 (x = 3.25),1363 (y = 1),1364 (z = 12),1365 (x_axis = 1.7),1366 (y_axis = 1),1367 (z_axis = 0.05)1368 );1369 addWall(1370 material_wall,1371 (x = 1.05),1372 (y = 1.8),1373 (z = 12),1374 (x_axis = 0.5),1375 (y_axis = 0.2),1376 (z_axis = 0.05)1377 );1378 addWall(1379 material_wall,1380 (x = 5),1381 (y = 1),1382 (z = 7),1383 (x_axis = 0.05),1384 (y_axis = 1),1385 (z_axis = 2)1386 );1387 addWall(1388 material_wall,1389 (x = 5),1390 (y = 1),1391 (z = 11),1392 (x_axis = 0.05),1393 (y_axis = 1),1394 (z_axis = 1)1395 );1396 addWall(1397 material_wall,1398 (x = 5),1399 (y = 1.8),1400 (z = 9.5),1401 (x_axis = 0.05),1402 (y_axis = 0.2),1403 (z_axis = 0.5)1404 );1405 addWall(1406 material_wall,1407 (x = 0.95),1408 (y = 1),1409 (z = 17),1410 (x_axis = 4),1411 (y_axis = 1),1412 (z_axis = 0.05)1413 );1414 addWall(1415 material_wall,1416 (x = 5),1417 (y = 1),1418 (z = 14.5),1419 (x_axis = 0.05),1420 (y_axis = 1),1421 (z_axis = 2.55)1422 );1423 addWall(1424 material_wall,1425 (x = -5),1426 (y = 1),1427 (z = -1.45),1428 (x_axis = 0.05),1429 (y_axis = 1),1430 (z_axis = 1.5)1431 );1432 addWall(1433 material_wall,1434 (x = -4.05),1435 (y = 1),1436 (z = -2.95),1437 (x_axis = 1),1438 (y_axis = 1),1439 (z_axis = 0.05)1440 );1441 addWall(1442 material_wall,1443 (x = -3),1444 (y = 1),1445 (z = -6),1446 (x_axis = 0.05),1447 (y_axis = 1),1448 (z_axis = 3.1)1449 );1450 addWall(1451 material_wall,1452 (x = 5),1453 (y = 1),1454 (z = -2),1455 (x_axis = 0.05),1456 (y_axis = 1),1457 (z_axis = 2)1458 );1459 addWall(1460 material_wall,1461 (x = 5),1462 (y = 1),1463 (z = -7),1464 (x_axis = 0.05),1465 (y_axis = 1),1466 (z_axis = 2)1467 );1468 addWall(1469 material_wall,1470 (x = 5),1471 (y = 1.8),1472 (z = -4.5),1473 (x_axis = 0.05),1474 (y_axis = 0.2),1475 (z_axis = 0.5)1476 );1477 addWall(1478 material_wall,1479 (x = -1.25),1480 (y = 1),1481 (z = -9.05),1482 (x_axis = 1.8),1483 (y_axis = 1),1484 (z_axis = 0.05)1485 );1486 addWall(1487 material_wall,1488 (x = 3.25),1489 (y = 1),1490 (z = -9.05),1491 (x_axis = 1.7),1492 (y_axis = 1),1493 (z_axis = 0.05)1494 );1495 addWall(1496 material_wall,1497 (x = 1.05),1498 (y = 1.8),1499 (z = -9.05),1500 (x_axis = 0.5),1501 (y_axis = 0.2),1502 (z_axis = 0.05)1503 );1504 addWall(1505 material_wall,1506 (x = -3),1507 (y = 1),1508 (z = -10.5),1509 (x_axis = 0.05),1510 (y_axis = 1),1511 (z_axis = 1.5)1512 );1513 addWall(1514 material_wall,1515 (x = 1),1516 (y = 1),1517 (z = -11.95),1518 (x_axis = 4),1519 (y_axis = 1),1520 (z_axis = 0.05)1521 );1522 addWall(1523 material_wall,1524 (x = 5),1525 (y = 1),1526 (z = -10.5),1527 (x_axis = 0.05),1528 (y_axis = 1),1529 (z_axis = 1.5)1530 );1531 addWall(1532 material_wall,1533 (x = -3.7),1534 (y = 1),1535 (z = -11.95),1536 (x_axis = 0.7),1537 (y_axis = 1),1538 (z_axis = 0.05)1539 );1540 addWall(1541 material_wall,1542 (x = -4.4),1543 (y = 1),1544 (z = -14.4),1545 (x_axis = 0.05),1546 (y_axis = 1),1547 (z_axis = 2.5)1548 );1549 addWall(1550 material_wall,1551 (x = -1.95),1552 (y = 1),1553 (z = -16.9),1554 (x_axis = 2.5),1555 (y_axis = 1),1556 (z_axis = 0.05)1557 );1558 addWall(1559 material_wall,1560 (x = 0.55),1561 (y = 1),1562 (z = -15.95),1563 (x_axis = 0.05),1564 (y_axis = 1),1565 (z_axis = 1)1566 );1567 addWall(1568 material_wall,1569 (x = 4),1570 (y = 1),1571 (z = -12.5),1572 (x_axis = 0.05),1573 (y_axis = 1),1574 (z_axis = 0.5)1575 );1576 addWall(1577 material_wall,1578 (x = 4),1579 (y = 1),1580 (z = -14.5),1581 (x_axis = 0.05),1582 (y_axis = 1),1583 (z_axis = 0.5)1584 );1585 addWall(1586 material_wall,1587 (x = 4),1588 (y = 1.8),1589 (z = -13.5),1590 (x_axis = 0.05),1591 (y_axis = 0.2),1592 (z_axis = 0.5)1593 );1594 addWall(1595 material_wall,1596 (x = 2.3),1597 (y = 1),1598 (z = -15),1599 (x_axis = 1.75),1600 (y_axis = 1),1601 (z_axis = 0.05)1602 );1603 addWall(1604 material_wall,1605 (x = 5.8),1606 (y = 1),1607 (z = -15),1608 (x_axis = 1.75),1609 (y_axis = 1),1610 (z_axis = 0.05)1611 );1612 addWall(1613 material_wall,1614 (x = 6.8),1615 (y = 1),1616 (z = -9.05),1617 (x_axis = 0.7),1618 (y_axis = 1),1619 (z_axis = 0.05)1620 );1621 addWall(1622 material_wall,1623 (x = 5.5),1624 (y = 1.8),1625 (z = -9.05),1626 (x_axis = 0.6),1627 (y_axis = 0.2),1628 (z_axis = 0.05)1629 );1630 addWall(1631 material_wall,1632 (x = 7.5),1633 (y = 1),1634 (z = -7),1635 (x_axis = 0.05),1636 (y_axis = 1),1637 (z_axis = 2.1)1638 );1639 addWall(1640 material_wall,1641 (x = 7.5),1642 (y = 1),1643 (z = -12),1644 (x_axis = 0.05),1645 (y_axis = 1),1646 (z_axis = 3)1647 );1648 addWall(1649 material_wall,1650 (x = 10.5),1651 (y = 1),1652 (z = -9.05),1653 (x_axis = 3),1654 (y_axis = 1),1655 (z_axis = 0.05)1656 );1657 addWall(1658 material_wall,1659 (x = 13.5),1660 (y = 1),1661 (z = -5.6),1662 (x_axis = 0.05),1663 (y_axis = 1),1664 (z_axis = 3.5)1665 );1666 addWall(1667 material_wall,1668 (x = 8),1669 (y = 1),1670 (z = -2.1),1671 (x_axis = 0.5),1672 (y_axis = 1),1673 (z_axis = 0.05)1674 );1675 addWall(1676 material_wall,1677 (x = 9),1678 (y = 1.8),1679 (z = -2.1),1680 (x_axis = 0.5),1681 (y_axis = 0.2),1682 (z_axis = 0.05)1683 );1684 addWall(1685 material_wall,1686 (x = 11.5),1687 (y = 1),1688 (z = -2.1),1689 (x_axis = 2),1690 (y_axis = 1),1691 (z_axis = 0.05)1692 );1693 addWall(1694 material_wall,1695 (x = 7.5),1696 (y = 1),1697 (z = -2.95),1698 (x_axis = 0.05),1699 (y_axis = 1),1700 (z_axis = 0.9)1701 );1702 addWall(1703 material_wall,1704 (x = 7.5),1705 (y = 1.8),1706 (z = -4.4),1707 (x_axis = 0.05),1708 (y_axis = 0.2),1709 (z_axis = 0.55)1710 );1711 addWall(1712 material_wall,1713 (x = 7.5),1714 (y = 1),1715 (z = -0.05),1716 (x_axis = 0.05),1717 (y_axis = 1),1718 (z_axis = 2)1719 );1720 addWall(1721 material_wall,1722 (x = 7.5),1723 (y = 1),1724 (z = 5.1),1725 (x_axis = 0.05),1726 (y_axis = 1),1727 (z_axis = 2.1)1728 );1729 addWall(1730 material_wall,1731 (x = 7.5),1732 (y = 1.8),1733 (z = 2.45),1734 (x_axis = 0.05),1735 (y_axis = 0.2),1736 (z_axis = 0.55)1737 );1738 addWall(1739 material_wall,1740 (x = 8),1741 (y = 1),1742 (z = 7.15),1743 (x_axis = 0.5),1744 (y_axis = 1),1745 (z_axis = 0.05)1746 );1747 addWall(1748 material_wall,1749 (x = 9),1750 (y = 1.8),1751 (z = 7.15),1752 (x_axis = 0.5),1753 (y_axis = 0.2),1754 (z_axis = 0.05)1755 );1756 addWall(1757 material_wall,1758 (x = 11.5),1759 (y = 1),1760 (z = 7.15),1761 (x_axis = 2),1762 (y_axis = 1),1763 (z_axis = 0.05)1764 );1765 addWall(1766 material_wall,1767 (x = 13.5),1768 (y = 1),1769 (z = 2.5),1770 (x_axis = 0.05),1771 (y_axis = 1),1772 (z_axis = 4.7)1773 );1774 addWall(1775 material_wall,1776 (x = 7.5),1777 (y = 1),1778 (z = 8.1),1779 (x_axis = 0.05),1780 (y_axis = 1),1781 (z_axis = 0.9)1782 );1783 addWall(1784 material_wall,1785 (x = 7.5),1786 (y = 1.8),1787 (z = 9.55),1788 (x_axis = 0.05),1789 (y_axis = 0.2),1790 (z_axis = 0.55)1791 );1792 addWall(1793 material_wall,1794 (x = 7.5),1795 (y = 1),1796 (z = 12.1),1797 (x_axis = 0.05),1798 (y_axis = 1),1799 (z_axis = 2)1800 );1801 addWall(1802 material_wall,1803 (x = 10.6),1804 (y = 1),1805 (z = 15.55),1806 (x_axis = 0.05),1807 (y_axis = 1),1808 (z_axis = 1.5)1809 );1810 addWall(1811 material_wall,1812 (x = 13.5),1813 (y = 1),1814 (z = 10.6),1815 (x_axis = 0.05),1816 (y_axis = 1),1817 (z_axis = 3.5)1818 );1819 addWall(1820 material_wall,1821 (x = 10.5),1822 (y = 1),1823 (z = 14.05),1824 (x_axis = 3),1825 (y_axis = 1),1826 (z_axis = 0.05)1827 );1828 addWall(1829 material_wall,1830 (x = 7.8),1831 (y = 1),1832 (z = 17),1833 (x_axis = 2.8),1834 (y_axis = 1),1835 (z_axis = 0.05)1836 );1837 addWall(1838 material_wall,1839 (x = 6.8),1840 (y = 1),1841 (z = 14.05),1842 (x_axis = 0.65),1843 (y_axis = 1),1844 (z_axis = 0.05)1845 );1846 addWall(1847 material_wall,1848 (x = 5.6),1849 (y = 1.8),1850 (z = 14.05),1851 (x_axis = 0.6),1852 (y_axis = 0.2),1853 (z_axis = 0.05)1854 );18551856 addWall(1857 material_wall,1858 (x = 6.7),1859 (y = 0.011),1860 (z = 16.25),1861 (x_axis = 0.15),1862 (y_axis = 0.01),1863 (z_axis = 0.75)1864 );1865 addWall(1866 material_wall,1867 (x = 7),1868 (y = 0.05),1869 (z = 16.25),1870 (x_axis = 0.15),1871 (y_axis = 0.05),1872 (z_axis = 0.75)1873 );1874 addWall(1875 material_wall,1876 (x = 7.3),1877 (y = 0.15),1878 (z = 16.25),1879 (x_axis = 0.15),1880 (y_axis = 0.05),1881 (z_axis = 0.75)1882 );1883 addWall(1884 material_wall,1885 (x = 7.6),1886 (y = 0.25),1887 (z = 16.25),1888 (x_axis = 0.15),1889 (y_axis = 0.05),1890 (z_axis = 0.75)1891 );1892 addWall(1893 material_wall,1894 (x = 7.9),1895 (y = 0.35),1896 (z = 16.25),1897 (x_axis = 0.15),1898 (y_axis = 0.05),1899 (z_axis = 0.75)1900 );1901 addWall(1902 material_wall,1903 (x = 8.2),1904 (y = 0.45),1905 (z = 16.25),1906 (x_axis = 0.15),1907 (y_axis = 0.05),1908 (z_axis = 0.75)1909 );1910 addWall(1911 material_wall,1912 (x = 8.5),1913 (y = 0.55),1914 (z = 16.25),1915 (x_axis = 0.15),1916 (y_axis = 0.05),1917 (z_axis = 0.75)1918 );1919 addWall(1920 material_wall,1921 (x = 8.8),1922 (y = 0.65),1923 (z = 16.25),1924 (x_axis = 0.15),1925 (y_axis = 0.05),1926 (z_axis = 0.75)1927 );1928 addWall(1929 material_wall,1930 (x = 9.1),1931 (y = 0.75),1932 (z = 16.25),1933 (x_axis = 0.15),1934 (y_axis = 0.05),1935 (z_axis = 0.75)1936 );1937 addWall(1938 material_wall,1939 (x = 9.4),1940 (y = 0.85),1941 (z = 16.25),1942 (x_axis = 0.15),1943 (y_axis = 0.05),1944 (z_axis = 0.75)1945 );1946 addWall(1947 material_wall,1948 (x = 10.05),1949 (y = 0.95),1950 (z = 15.5),1951 (x_axis = 0.5),1952 (y_axis = 0.05),1953 (z_axis = 1.5)1954 );1955 addWall(1956 material_wall,1957 (x = 9.4),1958 (y = 1.05),1959 (z = 14.75),1960 (x_axis = 0.15),1961 (y_axis = 0.05),1962 (z_axis = 0.75)1963 );1964 addWall(1965 material_wall,1966 (x = 9.1),1967 (y = 1.15),1968 (z = 14.75),1969 (x_axis = 0.15),1970 (y_axis = 0.05),1971 (z_axis = 0.75)1972 );1973 addWall(1974 material_wall,1975 (x = 8.8),1976 (y = 1.25),1977 (z = 14.75),1978 (x_axis = 0.15),1979 (y_axis = 0.05),1980 (z_axis = 0.75)1981 );1982 addWall(1983 material_wall,1984 (x = 8.5),1985 (y = 1.35),1986 (z = 14.75),1987 (x_axis = 0.15),1988 (y_axis = 0.05),1989 (z_axis = 0.75)1990 );1991 addWall(1992 material_wall,1993 (x = 8.2),1994 (y = 1.45),1995 (z = 14.75),1996 (x_axis = 0.15),1997 (y_axis = 0.05),1998 (z_axis = 0.75)1999 );2000 addWall(2001 material_wall,2002 (x = 7.9),2003 (y = 1.55),2004 (z = 14.75),2005 (x_axis = 0.15),2006 (y_axis = 0.05),2007 (z_axis = 0.75)2008 );2009 addWall(2010 material_wall,2011 (x = 7.6),2012 (y = 1.65),2013 (z = 14.75),2014 (x_axis = 0.15),2015 (y_axis = 0.05),2016 (z_axis = 0.75)2017 );2018 addWall(2019 material_wall,2020 (x = 7.3),2021 (y = 1.75),2022 (z = 14.75),2023 (x_axis = 0.15),2024 (y_axis = 0.05),2025 (z_axis = 0.75)2026 );2027 addWall(2028 material_wall,2029 (x = 7),2030 (y = 1.85),2031 (z = 14.75),2032 (x_axis = 0.15),2033 (y_axis = 0.05),2034 (z_axis = 0.75)2035 );2036 addWall(2037 material_wall,2038 (x = 6.7),2039 (y = 1.95),2040 (z = 14.75),2041 (x_axis = 0.15),2042 (y_axis = 0.05),2043 (z_axis = 0.75)2044 );2045 addWall(2046 material_wall,2047 (x = 6.7),2048 (y = 3),2049 (z = 15.5),2050 (x_axis = 0.15),2051 (y_axis = 1),2052 (z_axis = 1.5)2053 );2054 addWall(2055 material_wall,2056 (x = 8.05),2057 (y = 1.5),2058 (z = 15.5),2059 (x_axis = 1.4),2060 (y_axis = 3),2061 (z_axis = 0.01)2062 );2063 addPicture("images/closed.png", "front", 6.9, 2.4, 14.75);20642065 addWall(2066 material_floor,2067 (x = 5.25),2068 (y = 0.01),2069 (z = 2.5),2070 (x_axis = 8.22),2071 (y_axis = 0.01),2072 (z_axis = 11.5)2073 );2074 addWall(2075 material_floor,2076 (x = 2.25),2077 (y = 0.01),2078 (z = -12),2079 (x_axis = 5.2),2080 (y_axis = 0.01),2081 (z_axis = 3)2082 );2083 addWall(2084 material_floor,2085 (x = -3.95),2086 (y = 0.01),2087 (z = -1.47),2088 (x_axis = 1),2089 (y_axis = 0.01),2090 (z_axis = 1.5)2091 );2092 addWall(2093 material_floor,2094 (x = -3.95),2095 (y = 0.01),2096 (z = 6.47),2097 (x_axis = 1),2098 (y_axis = 0.01),2099 (z_axis = 1.5)2100 );2101 addWall(2102 material_floor,2103 (x = 3.75),2104 (y = 0.01),2105 (z = 15.5),2106 (x_axis = 6.75),2107 (y_axis = 0.01),2108 (z_axis = 1.5)2109 );2110 addWall(2111 material_floor,2112 (x = -1.9),2113 (y = 0.01),2114 (z = -15.95),2115 (x_axis = 2.45),2116 (y_axis = 0.01),2117 (z_axis = 0.97)2118 );2119 addWall(2120 material_floor,2121 (x = -3.65),2122 (y = 0.01),2123 (z = -13.5),2124 (x_axis = 0.75),2125 (y_axis = 0.01),2126 (z_axis = 1.5)2127 );21282129 addWall(2130 material_ceiling,2131 (x = 5.25),2132 (y = 1.99),2133 (z = 2.5),2134 (x_axis = 8.22),2135 (y_axis = 0.01),2136 (z_axis = 11.5)2137 );2138 addWall(2139 material_ceiling,2140 (x = 2.25),2141 (y = 1.99),2142 (z = -12),2143 (x_axis = 5.2),2144 (y_axis = 0.01),2145 (z_axis = 3)2146 );2147 addWall(2148 material_ceiling,2149 (x = -3.95),2150 (y = 1.99),2151 (z = -1.47),2152 (x_axis = 1),2153 (y_axis = 0.01),2154 (z_axis = 1.5)2155 );2156 addWall(2157 material_ceiling,2158 (x = -3.95),2159 (y = 1.99),2160 (z = 6.47),2161 (x_axis = 1),2162 (y_axis = 0.01),2163 (z_axis = 1.5)2164 );2165 addWall(2166 material_ceiling,2167 (x = 1.77),2168 (y = 1.99),2169 (z = 15.5),2170 (x_axis = 4.78),2171 (y_axis = 0.01),2172 (z_axis = 1.5)2173 );2174 addWall(2175 material_ceiling,2176 (x = -1.9),2177 (y = 1.99),2178 (z = -15.95),2179 (x_axis = 2.45),2180 (y_axis = 0.01),2181 (z_axis = 0.97)2182 );2183 addWall(2184 material_ceiling,2185 (x = -3.65),2186 (y = 1.99),2187 (z = -13.5),2188 (x_axis = 0.75),2189 (y_axis = 0.01),2190 (z_axis = 1.5)2191 );21922193 addWall(2194 material_floor,2195 (x = 5.25),2196 (y = 2.01),2197 (z = 2.5),2198 (x_axis = 8.22),2199 (y_axis = 0.01),2200 (z_axis = 11.5)2201 );2202 addWall(2203 material_floor,2204 (x = 2.25),2205 (y = 2.01),2206 (z = -12),2207 (x_axis = 5.2),2208 (y_axis = 0.01),2209 (z_axis = 3)2210 );2211 addWall(2212 material_floor,2213 (x = -3.95),2214 (y = 2.01),2215 (z = -1.47),2216 (x_axis = 1),2217 (y_axis = 0.01),2218 (z_axis = 1.5)2219 );2220 addWall(2221 material_floor,2222 (x = -3.95),2223 (y = 2.01),2224 (z = 6.47),2225 (x_axis = 1),2226 (y_axis = 0.01),2227 (z_axis = 1.5)2228 );2229 addWall(2230 material_floor,2231 (x = 1.77),2232 (y = 2.01),2233 (z = 15.5),2234 (x_axis = 4.78),2235 (y_axis = 0.01),2236 (z_axis = 1.5)2237 );2238 addWall(2239 material_floor,2240 (x = -1.9),2241 (y = 2.01),2242 (z = -15.95),2243 (x_axis = 2.45),2244 (y_axis = 0.01),2245 (z_axis = 0.97)2246 );2247 addWall(2248 material_floor,2249 (x = -3.65),2250 (y = 2.01),2251 (z = -13.5),2252 (x_axis = 0.75),2253 (y_axis = 0.01),2254 (z_axis = 1.5)2255 );2256}22572258async function addPicture(imageSrc, side, x, y, z) {2259 const img = new Image();2260 img.src = imageSrc;2261 img.decoding = "async";2262 img2263 .decode()2264 .then(function () {2265 THREE.ImageUtils.crossOrigin = ""; // CORS2266 var texture = THREE.ImageUtils.loadTexture(imageSrc);22672268 if (side == "front") {2269 var cubeGeo = new THREE.BoxGeometry(0.05, 1, img.width / img.height);2270 var sides_materials = [2271 new THREE.MeshBasicMaterial({ map: texture }),2272 new THREE.MeshBasicMaterial({ map: texture }),2273 new THREE.MeshBasicMaterial({ color: 0xffffff }),2274 new THREE.MeshBasicMaterial({ color: 0xffffff }),2275 new THREE.MeshBasicMaterial({ color: 0xffffff }),2276 new THREE.MeshBasicMaterial({ color: 0xffffff }),2277 ];2278 } else if (side == "lateral") {2279 var sides_materials = [2280 new THREE.MeshBasicMaterial({ color: 0xffffff }),2281 new THREE.MeshBasicMaterial({ color: 0xffffff }),2282 new THREE.MeshBasicMaterial({ color: 0xffffff }),2283 new THREE.MeshBasicMaterial({ color: 0xffffff }),2284 new THREE.MeshBasicMaterial({ map: texture }),2285 new THREE.MeshBasicMaterial({ map: texture }),2286 ];2287 var cubeGeo = new THREE.BoxGeometry(img.width / img.height, 1, 0.05);2288 }2289 var cubeMat = new THREE.MeshBasicMaterial({ map: texture });2290 sides_materials = new THREE.MeshFaceMaterial(sides_materials);2291 var cube = new THREE.Mesh(cubeGeo, sides_materials);2292 cube.position.set(x, y, z);2293 scene.add(cube);2294 })2295 .catch(function (error) {2296 console.log(error.message);2297 console.log(imageSrc);2298 });2299}23002301async function addLoading(imageSrc, side, x, y, z) {2302 const img = new Image();2303 img.src = imageSrc;2304 img.decoding = "async";2305 img2306 .decode()2307 .then(function () {2308 THREE.ImageUtils.crossOrigin = ""; // CORS2309 var texture = THREE.ImageUtils.loadTexture(imageSrc);23102311 if (side == "front") {2312 var cubeGeo = new THREE.BoxGeometry(0.01, 0.5, 0.5);2313 var sides_materials = [2314 new THREE.MeshBasicMaterial({ map: texture }),2315 new THREE.MeshBasicMaterial({ map: texture }),2316 new THREE.MeshBasicMaterial({ color: 0xffffff }),2317 new THREE.MeshBasicMaterial({ color: 0xffffff }),2318 new THREE.MeshBasicMaterial({ color: 0xffffff }),2319 new THREE.MeshBasicMaterial({ color: 0xffffff }),2320 ];2321 } else if (side == "lateral") {2322 var sides_materials = [2323 new THREE.MeshBasicMaterial({ color: 0xffffff }),2324 new THREE.MeshBasicMaterial({ color: 0xffffff }),2325 new THREE.MeshBasicMaterial({ color: 0xffffff }),2326 new THREE.MeshBasicMaterial({ color: 0xffffff }),2327 new THREE.MeshBasicMaterial({ map: texture }),2328 new THREE.MeshBasicMaterial({ map: texture }),2329 ];2330 var cubeGeo = new THREE.BoxGeometry(0.5, 0.5, 0.01);2331 }2332 var cubeMat = new THREE.MeshBasicMaterial({ map: texture });2333 sides_materials = new THREE.MeshFaceMaterial(sides_materials);2334 var cube = new THREE.Mesh(cubeGeo, sides_materials);2335 cube.position.set(x, y, z);2336 scene.add(cube);2337 })2338 .catch(function (error) {2339 console.log(error.message);2340 });2341}23422343async function getNFTs2(address) {2344 2345 let response = await fetch(`https://api-moonriver.moonscan.io/api?module=account&action=tokennfttx&address=${address}&startblock=0&endblock=999999999&sort=asc`);2346 let response2 = await response.json();23472348 const whitelistedCollections = [2349 "0xAb4202d07C4aBF7e019c3251881e82352b774EEe",2350 "0xd3a9c48df4d9342dc1a0ee2c185ce50588729fa9",2351 "0xb8017e9660960c58b63d2deda983de4a7912e379",2352 "0x0dad866dc0c13fb8e4a91d1b5e83cf3a61d4cee2",2353 "0xfc948004d29b2557cb6203f404db6fd90ae7e9fb",2354 "0xb6e9e605aa159017173caa6181c522db455f6661",2355 "0x1f953756a29d52f980038cbbff66375189075748",2356 "0x56f4ca4f9dbb29c9438d9de48bd07f4b7fa765a3",2357 "0x0f3a02fb8308b9c093f6f20ef6494c4c0488e044",2358 "0x4082d7b7a416554279148139ef0f707846b60dd9",2359 "0x54148c4d47414aa12bd3fd60c9114d6f7ea0a972",2360 "0x8236b2811c1a8f2b77707e11f9482d952aeda9cc",2361 "0xf868a89672232925226a608255218076cd989ad7",2362 "0x65985e00bfd44c9850f275802095ae16aefc902b",2363 "0x609a0abc38a0aac1d20f001fa9c599db2932678f", 2364 "0x513d226142f788d6fb7737f7cd366b1c92c6168a",2365 "0x2d4a19b306a496be628469de820f0367a13178e5",2366 "0xc433f820467107bc5176b95f3a58248c4332f8de",2367 "0x527dcb4dd5169ac018972df027c1133068b62fc7",2368 "0x4fde28a4b169a5c19d4400214dc0d7cbfb1a6006",2369 "0x1D7A2C9345E25aBab6e2Ce11A4D03E66D05f79F7",2370 "0x08716e418e68564C96b68192E985762740728018",2371 "0xD0df5418B1f30B1679Cb80Cce130EFf4Feb35d88",2372 "0x003967d80Bb2C4adcd2f1FC561a76b1bA630C770",2373 "0x2F26EfDb7233a014715ce6E895Aa67d846D93F1E",2374 ]23752376 let foundedCollections = [];23772378 const nftArray = {2379 collections: [],2380 total_nfts: 0,2381 error: false,2382 error_message: "",2383 };23842385 if(response2.result.length == 0){2386 return nftArray;2387 }23882389 if(response2.status == "0"){2390 nftArray.error = true;2391 nftArray.error_message = response2.result;2392 return nftArray;2393 }23942395 resultNFTs = response2.result;23962397 for (tx in resultNFTs) {2398 if(whitelistedCollections.includes(resultNFTs[tx].contractAddress.toLowerCase())){23992400 let contract = resultNFTs[tx].contractAddress;2401 let added = false;24022403 for (var i = 0; i < foundedCollections.length; i++) {2404 if (foundedCollections[i].contract == contract) {2405 added = true;2406 break;2407 }2408 }24092410 if (added == false) {2411 foundedCollections.push({2412 contract: contract.toLowerCase(),2413 title: resultNFTs[tx].tokenName,2414 ticker: resultNFTs[tx].tokenSymbol,2415 count: 0,2416 items: [],2417 });2418 }24192420 for (var i = 0; i < foundedCollections.length; i++) {2421 if (foundedCollections[i].contract == contract) {2422 foundedCollections[i].items.push(resultNFTs[tx].tokenID)2423 break;2424 }2425 }2426 }2427 }242824292430 for (var i = 0; i < foundedCollections.length; i++) {2431 const newArray = [];2432 const tokenUriPromises = [];2433 const tokenUris = [];24342435 const map = foundedCollections[i].items.reduce((acc, e) => acc.set(e, (acc.get(e) || 0) + 1), new Map());2436 const unique = [...map.keys()];2437 const frequency = [...map.values()];24382439 const abi = [{ "inputs": [ { "internalType": "uint256", "name": "tokenId", "type": "uint256" } ], "name": "tokenURI", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function" }];2440 const contractInstance = new web3.eth.Contract(abi, foundedCollections[i].contract);24412442 for(var j = 0; j < unique.length; j++){2443 if(frequency[j] % 2 == 1){2444 newArray.push(unique[j]);2445 tokenUriPromises.push(contractInstance.methods.tokenURI(unique[j]).call());2446 }2447 }24482449 let tokenUriTemp = await Promise.allSettled(tokenUriPromises);24502451 for(var k = 0; k < tokenUriTemp.length; k ++){2452 if(tokenUriTemp[k].status == "fulfilled"){2453 let uri = tokenUriTemp[k].value;2454 uri = uri.replace("ipfs://", "https://ipfs.infura.io/ipfs/");2455 uri = uri.replace("https://gateway.pinata.cloud/ipfs/", "https://ipfs.infura.io/ipfs/");2456 uri = uri.replace("https://ipfs.io/ipfs/", "https://ipfs.infura.io/ipfs/");2457 tokenUris.push(uri);2458 } 2459 }24602461 foundedCollections[i].items = newArray;2462 foundedCollections[i].tokenUris = tokenUris;2463 foundedCollections[i].count = tokenUris.length;2464 nftArray.total_nfts += tokenUris.length;2465 }24662467 nftArray.collections = foundedCollections;2468 return nftArray;2469}24702471247224732474function addSelectionBlock(arrayWithNFTs) {2475 let chain_info = document.getElementById("chain_info");2476 chain_info.innerHTML =2477 arrayWithNFTs.collections.length > 02478 ? "Scroll to view the list and click to select a collection"2479 : "No whitelisted NFT collections";2480 const nftList = document.getElementById("nftList");24812482 arrayWithNFTs.collections.map(async function (collection) {2483 if (collection.count) {2484 nftList.innerHTML += `2485 <li class="nft_item" data-contract="${collection.contract}" data-collectionCount="${collection.count}">2486 <div>2487 <span class="name">${collection.title} [${collection.ticker}]</span>2488 <span class="chain">Contract: <a href="https://moonriver.moonscan.io/token/${collection.contract}" target="_blank" >${collection.contract}</a></span>2489 <span class="count">${collection.count} NFTs</span>2490 </div>2491 <div>2492 <label class="switch">2493 <input type="checkbox" checked>2494 <span class="slider round"></span>2495 </label>2496 </div>2497 </li>`;2498 }2499 });25002501 const sliders = document.querySelectorAll(".slider");2502 sliders.forEach(function (slider, id_slider) {2503 slider.addEventListener("click", function () {2504 document2505 .getElementsByClassName("nft_item")2506 [id_slider].classList.toggle("checked");25072508 let colSelected = 0;2509 let nftsTotalSelected = 0;25102511 for (2512 var i = 0;2513 i < document.getElementsByClassName("nft_item").length;2514 i++2515 ) {2516 if (2517 document2518 .getElementsByClassName("nft_item")2519 [i].classList.contains("checked")2520 ) {2521 colSelected++;2522 nftsTotalSelected += parseInt(2523 document2524 .getElementsByClassName("nft_item")2525 [i].getAttribute("data-collectionCount")2526 );2527 }2528 }2529 document.getElementById(2530 "selected_collection"2531 ).innerHTML = `Collections selected: ${colSelected} [${nftsTotalSelected} NFTs]`;2532 });2533 });2534}25352536function addWindows() {2537 const arrayWindow = [2538 ["front", -5.05, 1, -1.48],2539 ["front", -5.05, 1, 6.51],2540 ["front", -3.05, 1, -7.25],2541 ["front", -4.45, 1, -14.53],2542 ["front", -3.05, 1, 12.5],2543 ["front", -5.05, 3, -1.48],2544 ["front", -5.05, 3, 6.51],2545 ["front", -3.05, 3, -7.25],2546 ["front", -4.45, 3, -14.53],2547 ["front", -3.05, 3, 12.5],2548 ];25492550 for (var i = 0; i < arrayWindow.length; i++) {2551 addPicture(2552 "images/window.png",2553 arrayWindow[i][0],2554 arrayWindow[i][1],2555 arrayWindow[i][2],2556 arrayWindow[i][3]2557 );2558 }25592560 addPicture("./../images/hackerlink.jpg", "front", -3.1, 0.85, 1);2561 addPicture("./../images/moonriverLogo.jpg", "front", -3.1, 0.85, 4);2562}25632564function addNFT(arrayNFT, collectionNameCount) {2565 const arrayPictures = [2566 ["lateral", -0.65, 1, 0.05],2567 ["lateral", -0.65, 1, 4.95],2568 ["lateral", 2.6, 1, 0.05],2569 ["lateral", 2.6, 1, 4.95],2570 ["front", 7.45, 1, -1],2571 ["front", 5.05, 1, -1],2572 ["front", 7.45, 1, 5.9],2573 ["front", 5.05, 1, 5.9],2574 ["front", 7.45, 1, 12.2],2575 ["front", 5.05, 1, 12.2],2576 ["front", 7.45, 1, -7],2577 ["front", 5.05, 1, -7],2578 ["front", 13.43, 1, 0.5],2579 ["front", 13.44, 1, 5],2580 ["lateral", 11.4, 1, 7.1],2581 ["lateral", 11.4, 1, -2.04],2582 ["front", 7.55, 1, 5.28],2583 ["front", 7.55, 1, -0.06],2584 ["lateral", 11.4, 1, 7.211],2585 ["front", 13.43, 1, 10.65],2586 ["lateral", 10.533, 1, 14],2587 ["front", 7.55, 1, 11.7],2588 ["lateral", 11.4, 1, -2.151],2589 ["front", 13.43, 1, -5.27],2590 ["lateral", 10.366, 1, -8.97],2591 ["front", 7.55, 1, -7.011],2592 ["front", 4.95, 1, 6.95],2593 ["lateral", 2.05, 1, 5.05],2594 ["lateral", -2.35, 1, 5.05],2595 ["lateral", 3.37, 1, 11.95],2596 ["lateral", -1.23, 1, 11.95],2597 ["front", -2.95, 1, 10.02],2598 ["front", -4.95, 1, 6.51],2599 ["front", 4.95, 1, -1.88],2600 ["front", 4.95, 1, -6.94],2601 ["lateral", 2.05, 1, -0.05],2602 ["lateral", -2.35, 1, -0.05],2603 ["lateral", 3.31, 1, -9],2604 ["lateral", -1.29, 1, -9],2605 ["front", -2.95, 1, -6.2],2606 ["front", -4.95, 1, -1.48],2607 ["lateral", 3.37, 1, 12.05],2608 ["lateral", -1.23, 1, 12.05],2609 ["front", 4.95, 1, 14.615],2610 ["front", -2.95, 1, 14.615],2611 ["lateral", 1, 1, 16.95],2612 ["lateral", 3.31, 1, -9.1],2613 ["lateral", -1.29, 1, -9.1],2614 ["lateral", 3.31, 1, -11.89],2615 ["lateral", -1.29, 1, -11.89],2616 ["lateral", -2.3, 1, -12],2617 ["lateral", 1.1, 1, -12],2618 ["front", -4.35, 1, -14.7],2619 ["lateral", -1.92, 1, -16.85],2620 ["lateral", 2.36, 1, -14.95],2621 ["lateral", 5.8, 1, -14.95],2622 ["front", 7.45, 1, -11.99],2623 ];26242625 let countMyNft = arrayNFT.length;2626 if (countMyNft >= arrayPictures.length) {2627 countMyNft = arrayPictures.length;2628 }26292630 info_log_left.innerHTML = ` 2631 <b>- Address:</b> ${walletAddress.value}<br>2632 <b>- Selected collections:</b> ${collectionNameCount}<br>2633 <b>- Gallery capacity:</b> max. 57 NFTs<br> `;26342635 for (var i = 0; i < countMyNft; i++) {2636 arrayNFT[i].image = arrayNFT[i].image.replace("ipfs://", "https://ipfs.infura.io/ipfs/");2637 arrayNFT[i].image = arrayNFT[i].image.replace("https://gateway.pinata.cloud/ipfs/", "https://ipfs.infura.io/ipfs/");2638 arrayNFT[i].image = arrayNFT[i].image.replace("https://ipfs.io/ipfs/", "https://ipfs.infura.io/ipfs/");26392640 addLoading(2641 "images/loading.png",2642 arrayPictures[i][0],2643 arrayPictures[i][1],2644 arrayPictures[i][2],2645 arrayPictures[i][3]2646 );2647 addPicture(2648 arrayNFT[i].image,2649 arrayPictures[i][0],2650 arrayPictures[i][1],2651 arrayPictures[i][2],2652 arrayPictures[i][3]2653 );2654 addCanvas(2655 `${arrayNFT[i].name}`,2656 arrayPictures[i][0],2657 arrayPictures[i][1],2658 arrayPictures[i][3]2659 );2660 }26612662 for (var i = countMyNft; i < arrayPictures.length; i++) {2663 addPicture(2664 "images/null.png",2665 arrayPictures[i][0],2666 arrayPictures[i][1],2667 arrayPictures[i][2],2668 arrayPictures[i][3]2669 );2670 }2671}26722673var PIXEL_RATIO = (function () {2674 var ctx = document.createElement("canvas").getContext("2d"),2675 dpr = window.devicePixelRatio || 1,2676 bsr =2677 ctx.webkitBackingStorePixelRatio ||2678 ctx.mozBackingStorePixelRatio ||2679 ctx.msBackingStorePixelRatio ||2680 ctx.oBackingStorePixelRatio ||2681 ctx.backingStorePixelRatio ||2682 1;26832684 return dpr / bsr;2685})();26862687createHiDPICanvas = function (w, h, ratio) {2688 if (!ratio) {2689 ratio = PIXEL_RATIO;2690 }2691 var can = document.createElement("canvas");2692 can.width = w * ratio;2693 can.height = h * ratio;2694 can.style.width = w + "px";2695 can.style.height = h + "px";2696 can.getContext("2d").setTransform(ratio, 0, 0, ratio, 0, 0);2697 return can;2698};26992700function addCanvas(title, side, x, z) {2701 var geometry1, texture1, mesh1, material1, ctx, canvas;27022703 if (side == "front") {2704 canvas = createHiDPICanvas(360, 40, 1);2705 ctx = canvas.getContext("2d");2706 ctx.font = "15pt Arial";2707 ctx.fillStyle = "white";2708 ctx.fillRect(2, 2, canvas.width - 4, canvas.height - 4);2709 ctx.fillStyle = "black";2710 ctx.textAlign = "center";2711 ctx.textBaseline = "middle";2712 ctx.fillText(title, canvas.width / 2, 20);2713 texture1 = new THREE.Texture(canvas);2714 texture1.needsUpdate = true;2715 material1 = new THREE.MeshBasicMaterial({2716 map: texture1,2717 side: THREE.DoubleSide,2718 });2719 geometry1 = new THREE.PlaneGeometry(1.8, 0.2);2720 mesh1 = new THREE.Mesh(geometry1, material1);2721 mesh1.position.set(x + 0.005, 0.3, z);2722 mesh1.rotation.y = Math.PI / 2;2723 scene.add(mesh1);27242725 canvas = createHiDPICanvas(360, 40, 1);2726 ctx = canvas.getContext("2d");2727 ctx.font = "15pt Arial";2728 ctx.fillStyle = "white";2729 ctx.fillRect(2, 2, canvas.width - 4, canvas.height - 4);2730 ctx.fillStyle = "black";2731 ctx.textAlign = "center";2732 ctx.textBaseline = "middle";2733 ctx.fillText(title, canvas.width / 2, 20);2734 texture1 = new THREE.Texture(canvas);2735 texture1.needsUpdate = true;2736 material1 = new THREE.MeshBasicMaterial({2737 map: texture1,2738 side: THREE.DoubleSide,2739 });2740 geometry1 = new THREE.PlaneGeometry(1.8, 0.2);2741 mesh1 = new THREE.Mesh(geometry1, material1);2742 mesh1.position.set(x - 0.01, 0.3, z);2743 mesh1.rotation.y = -Math.PI / 2;2744 scene.add(mesh1);2745 } else if (side == "lateral") {2746 canvas = createHiDPICanvas(360, 40, 1);2747 ctx = canvas.getContext("2d");2748 ctx.font = "15pt Arial";2749 ctx.fillStyle = "white";2750 ctx.fillRect(2, 2, canvas.width - 4, canvas.height - 4);2751 ctx.fillStyle = "black";2752 ctx.textAlign = "center";2753 ctx.textBaseline = "middle";2754 ctx.fillText(title, canvas.width / 2, 20);2755 texture1 = new THREE.Texture(canvas);2756 texture1.needsUpdate = true;2757 material1 = new THREE.MeshBasicMaterial({2758 map: texture1,2759 side: THREE.DoubleSide,2760 });2761 geometry1 = new THREE.PlaneGeometry(1.8, 0.2);2762 mesh1 = new THREE.Mesh(geometry1, material1);2763 mesh1.position.set(x, 0.3, z + 0.01);2764 scene.add(mesh1);27652766 canvas = createHiDPICanvas(360, 40, 1);2767 ctx = canvas.getContext("2d");2768 ctx.font = "15pt Arial";2769 ctx.fillStyle = "white";2770 ctx.fillRect(2, 2, canvas.width - 4, canvas.height - 4);2771 ctx.fillStyle = "black";2772 ctx.textAlign = "center";2773 ctx.textBaseline = "middle";2774 ctx.fillText(title, canvas.width / 2, 20);2775 texture1 = new THREE.Texture(canvas);2776 texture1.needsUpdate = true;2777 material1 = new THREE.MeshBasicMaterial({2778 map: texture1,2779 side: THREE.DoubleSide,2780 });2781 geometry1 = new THREE.PlaneGeometry(1.8, 0.2);2782 mesh1 = new THREE.Mesh(geometry1, material1);2783 mesh1.position.set(x, 0.3, z - 0.02);2784 mesh1.rotation.y = Math.PI;2785 scene.add(mesh1);2786 }
...
interactive2.js
Source:interactive2.js
1var spec2 = {2 "$schema": "https://vega.github.io/schema/vega/v5.json",3 "background": "white",4 "padding": 5,5 "height": 300,6 "data": [7 {"name": "selector014_store"},8 {"name": "selector015_store"},9 {10 "name": "data-34161eebc7e6103e8e00b60ac821ba4b",11 "values": [12 {13 "x_axis": -1.2535821199417114,14 "y_axis": 3.586676597595215,15 "name": "prince",16 "original": "prince"17 },18 {19 "x_axis": -0.9741005897521973,20 "y_axis": 3.7290642261505127,21 "name": "princess",22 "original": "princess"23 },24 {25 "x_axis": -1.0501278638839722,26 "y_axis": -2.0268447399139404,27 "name": "nurse",28 "original": "nurse"29 },30 {31 "x_axis": -0.9151343703269958,32 "y_axis": -2.0640790462493896,33 "name": "doctor",34 "original": "doctor"35 },36 {37 "x_axis": 0.8430215716362,38 "y_axis": -0.06272825598716736,39 "name": "banker",40 "original": "banker"41 },42 {43 "x_axis": -0.43132147192955017,44 "y_axis": -1.5975831747055054,45 "name": "man",46 "original": "man"47 },48 {49 "x_axis": -1.073258876800537,50 "y_axis": -1.6417843103408813,51 "name": "woman",52 "original": "woman"53 },54 {55 "x_axis": -3.006711006164551,56 "y_axis": 0.08844566345214844,57 "name": "cousin",58 "original": "cousin"59 },60 {61 "x_axis": -3.256138563156128,62 "y_axis": -0.2640823423862457,63 "name": "neice",64 "original": "neice"65 },66 {67 "x_axis": -0.8844128251075745,68 "y_axis": 4.284396648406982,69 "name": "king",70 "original": "king"71 },72 {73 "x_axis": -0.9637596607208252,74 "y_axis": 3.8633878231048584,75 "name": "queen",76 "original": "queen"77 },78 {79 "x_axis": -0.37136709690093994,80 "y_axis": -1.4314926862716675,81 "name": "dude",82 "original": "dude"83 },84 {85 "x_axis": -0.33022043108940125,86 "y_axis": -2.0039174556732178,87 "name": "guy",88 "original": "guy"89 },90 {91 "x_axis": 0.005235184449702501,92 "y_axis": -1.1506175994873047,93 "name": "gal",94 "original": "gal"95 },96 {97 "x_axis": 2.1890616416931152,98 "y_axis": -0.3874746263027191,99 "name": "fire",100 "original": "fire"101 },102 {103 "x_axis": 0.8451134562492371,104 "y_axis": -1.5011231899261475,105 "name": "dog",106 "original": "dog"107 },108 {109 "x_axis": 0.9290971755981445,110 "y_axis": -0.6315348148345947,111 "name": "cat",112 "original": "cat"113 },114 {115 "x_axis": 1.9717415571212769,116 "y_axis": 0.1653272807598114,117 "name": "mouse",118 "original": "mouse"119 },120 {121 "x_axis": 3.6464710235595703,122 "y_axis": 0.8340242505073547,123 "name": "red",124 "original": "red"125 },126 {127 "x_axis": 0.6217125654220581,128 "y_axis": -0.011615407653152943,129 "name": "blue",130 "original": "blue"131 },132 {133 "x_axis": 4.070711135864258,134 "y_axis": 0.8428587913513184,135 "name": "green",136 "original": "green"137 },138 {139 "x_axis": 3.9739019870758057,140 "y_axis": 0.8420842289924622,141 "name": "yellow",142 "original": "yellow"143 },144 {145 "x_axis": 3.1992409229278564,146 "y_axis": -0.76308274269104,147 "name": "water",148 "original": "water"149 },150 {151 "x_axis": -0.4370383024215698,152 "y_axis": -1.8055583238601685,153 "name": "person",154 "original": "person"155 },156 {157 "x_axis": -1.5232115983963013,158 "y_axis": -0.6766523718833923,159 "name": "family",160 "original": "family"161 },162 {163 "x_axis": -2.889375925064087,164 "y_axis": -0.0504235103726387,165 "name": "brother",166 "original": "brother"167 },168 {169 "x_axis": -2.935547351837158,170 "y_axis": -0.16567137837409973,171 "name": "sister",172 "original": "sister"173 }174 ]175 },176 {177 "name": "data-52c1f752db2a63c001d356078f606383",178 "values": [179 {180 "x_axis": -3.5124354362487793,181 "y_axis": 4.162352561950684,182 "name": "prince",183 "original": "prince"184 },185 {186 "x_axis": -4.112173080444336,187 "y_axis": 3.8549747467041016,188 "name": "princess",189 "original": "princess"190 },191 {192 "x_axis": -2.517472982406616,193 "y_axis": 3.284545421600342,194 "name": "nurse",195 "original": "nurse"196 },197 {198 "x_axis": -2.7008538246154785,199 "y_axis": 2.768869161605835,200 "name": "doctor",201 "original": "doctor"202 },203 {204 "x_axis": -5.004579067230225,205 "y_axis": 1.7548115253448486,206 "name": "banker",207 "original": "banker"208 },209 {210 "x_axis": -4.107402801513672,211 "y_axis": 1.0861294269561768,212 "name": "man",213 "original": "man"214 },215 {216 "x_axis": -3.2791190147399902,217 "y_axis": 2.9917562007904053,218 "name": "woman",219 "original": "woman"220 },221 {222 "x_axis": -4.7013444900512695,223 "y_axis": 2.9227752685546875,224 "name": "cousin",225 "original": "cousin"226 },227 {228 "x_axis": -4.299141883850098,229 "y_axis": 3.142744541168213,230 "name": "neice",231 "original": "neice"232 },233 {234 "x_axis": -3.8987667560577393,235 "y_axis": 4.549572944641113,236 "name": "king",237 "original": "king"238 },239 {240 "x_axis": -4.172970771789551,241 "y_axis": 4.277510166168213,242 "name": "queen",243 "original": "queen"244 },245 {246 "x_axis": -3.4013280868530273,247 "y_axis": 1.4507380723953247,248 "name": "dude",249 "original": "dude"250 },251 {252 "x_axis": -3.7617805004119873,253 "y_axis": 1.7864001989364624,254 "name": "guy",255 "original": "guy"256 },257 {258 "x_axis": -4.434903144836426,259 "y_axis": 2.3134303092956543,260 "name": "gal",261 "original": "gal"262 },263 {264 "x_axis": -4.485660552978516,265 "y_axis": 0.5962796211242676,266 "name": "fire",267 "original": "fire"268 },269 {270 "x_axis": -2.884521007537842,271 "y_axis": 2.0245754718780518,272 "name": "dog",273 "original": "dog"274 },275 {276 "x_axis": -2.6612389087677,277 "y_axis": 1.595794677734375,278 "name": "cat",279 "original": "cat"280 },281 {282 "x_axis": -2.7900476455688477,283 "y_axis": 1.0407456159591675,284 "name": "mouse",285 "original": "mouse"286 },287 {288 "x_axis": -3.018948793411255,289 "y_axis": 0.13132251799106598,290 "name": "red",291 "original": "red"292 },293 {294 "x_axis": -4.6628098487854,295 "y_axis": 1.299612283706665,296 "name": "blue",297 "original": "blue"298 },299 {300 "x_axis": -3.5633227825164795,301 "y_axis": 0.1778898686170578,302 "name": "green",303 "original": "green"304 },305 {306 "x_axis": -3.127549409866333,307 "y_axis": 0.4946957230567932,308 "name": "yellow",309 "original": "yellow"310 },311 {312 "x_axis": -4.0959014892578125,313 "y_axis": 0.3415285348892212,314 "name": "water",315 "original": "water"316 },317 {318 "x_axis": -4.049440383911133,319 "y_axis": 1.783280611038208,320 "name": "person",321 "original": "person"322 },323 {324 "x_axis": -3.8789079189300537,325 "y_axis": 2.7418227195739746,326 "name": "family",327 "original": "family"328 },329 {330 "x_axis": -3.6723387241363525,331 "y_axis": 2.3849875926971436,332 "name": "brother",333 "original": "brother"334 },335 {336 "x_axis": -3.6647908687591553,337 "y_axis": 3.161151647567749,338 "name": "sister",339 "original": "sister"340 }341 ]342 },343 {344 "name": "data_0",345 "source": "data-34161eebc7e6103e8e00b60ac821ba4b",346 "transform": [347 {348 "type": "filter",349 "expr": "isValid(datum[\"x_axis\"]) && isFinite(+datum[\"x_axis\"]) && isValid(datum[\"y_axis\"]) && isFinite(+datum[\"y_axis\"])"350 }351 ]352 },353 {354 "name": "data_1",355 "source": "data-52c1f752db2a63c001d356078f606383",356 "transform": [357 {358 "type": "filter",359 "expr": "isValid(datum[\"x_axis\"]) && isFinite(+datum[\"x_axis\"]) && isValid(datum[\"y_axis\"]) && isFinite(+datum[\"y_axis\"])"360 }361 ]362 }363 ],364 "signals": [365 {"name": "concat_0_width", "value": 300},366 {"name": "concat_1_width", "value": 300},367 {368 "name": "unit",369 "value": {},370 "on": [371 {"events": "mousemove", "update": "isTuple(group()) ? group() : unit"}372 ]373 },374 {375 "name": "selector014",376 "update": "{\"x_axis\": selector014_x_axis, \"y_axis\": selector014_y_axis}"377 },378 {"name": "selector014_x_axis"},379 {"name": "selector014_y_axis"},380 {381 "name": "selector015",382 "update": "{\"x_axis\": selector015_x_axis, \"y_axis\": selector015_y_axis}"383 },384 {"name": "selector015_x_axis"},385 {"name": "selector015_y_axis"}386 ],387 "layout": {"padding": 20, "bounds": "full", "align": "each"},388 "marks": [389 {390 "type": "group",391 "name": "concat_0_group",392 "title": {"text": "Dimension 0 vs. Dimension 1", "frame": "group"},393 "style": "cell",394 "encode": {395 "update": {396 "width": {"signal": "concat_0_width"},397 "height": {"signal": "height"}398 }399 },400 "signals": [401 {402 "name": "selector014_x_axis",403 "on": [404 {405 "events": {"signal": "selector014_translate_delta"},406 "update": "panLinear(selector014_translate_anchor.extent_x, -selector014_translate_delta.x / concat_0_width)"407 },408 {409 "events": {"signal": "selector014_zoom_delta"},410 "update": "zoomLinear(domain(\"concat_0_x\"), selector014_zoom_anchor.x, selector014_zoom_delta)"411 },412 {413 "events": [{"source": "scope", "type": "dblclick"}],414 "update": "null"415 }416 ],417 "push": "outer"418 },419 {420 "name": "selector014_y_axis",421 "on": [422 {423 "events": {"signal": "selector014_translate_delta"},424 "update": "panLinear(selector014_translate_anchor.extent_y, selector014_translate_delta.y / height)"425 },426 {427 "events": {"signal": "selector014_zoom_delta"},428 "update": "zoomLinear(domain(\"concat_0_y\"), selector014_zoom_anchor.y, selector014_zoom_delta)"429 },430 {431 "events": [{"source": "scope", "type": "dblclick"}],432 "update": "null"433 }434 ],435 "push": "outer"436 },437 {438 "name": "selector014_tuple",439 "on": [440 {441 "events": [442 {"signal": "selector014_x_axis || selector014_y_axis"}443 ],444 "update": "selector014_x_axis && selector014_y_axis ? {unit: \"concat_0_layer_0\", fields: selector014_tuple_fields, values: [selector014_x_axis,selector014_y_axis]} : null"445 }446 ]447 },448 {449 "name": "selector014_tuple_fields",450 "value": [451 {"field": "x_axis", "channel": "x", "type": "R"},452 {"field": "y_axis", "channel": "y", "type": "R"}453 ]454 },455 {456 "name": "selector014_translate_anchor",457 "value": {},458 "on": [459 {460 "events": [{"source": "scope", "type": "mousedown"}],461 "update": "{x: x(unit), y: y(unit), extent_x: domain(\"concat_0_x\"), extent_y: domain(\"concat_0_y\")}"462 }463 ]464 },465 {466 "name": "selector014_translate_delta",467 "value": {},468 "on": [469 {470 "events": [471 {472 "source": "window",473 "type": "mousemove",474 "consume": true,475 "between": [476 {"source": "scope", "type": "mousedown"},477 {"source": "window", "type": "mouseup"}478 ]479 }480 ],481 "update": "{x: selector014_translate_anchor.x - x(unit), y: selector014_translate_anchor.y - y(unit)}"482 }483 ]484 },485 {486 "name": "selector014_zoom_anchor",487 "on": [488 {489 "events": [{"source": "scope", "type": "wheel", "consume": true}],490 "update": "{x: invert(\"concat_0_x\", x(unit)), y: invert(\"concat_0_y\", y(unit))}"491 }492 ]493 },494 {495 "name": "selector014_zoom_delta",496 "on": [497 {498 "events": [{"source": "scope", "type": "wheel", "consume": true}],499 "force": true,500 "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))"501 }502 ]503 },504 {505 "name": "selector014_modify",506 "on": [507 {508 "events": {"signal": "selector014_tuple"},509 "update": "modify(\"selector014_store\", selector014_tuple, true)"510 }511 ]512 }513 ],514 "marks": [515 {516 "name": "concat_0_layer_0_marks",517 "type": "symbol",518 "clip": true,519 "style": ["circle"],520 "interactive": true,521 "from": {"data": "data_0"},522 "encode": {523 "update": {524 "opacity": {"value": 0.7},525 "size": {"value": 60},526 "fill": {"value": "#4c78a8"},527 "tooltip": {528 "signal": "{\"name\": ''+datum[\"name\"], \"original\": ''+datum[\"original\"]}"529 },530 "x": {"scale": "concat_0_x", "field": "x_axis"},531 "y": {"scale": "concat_0_y", "field": "y_axis"},532 "shape": {"value": "circle"}533 }534 }535 },536 {537 "name": "concat_0_layer_1_marks",538 "type": "text",539 "clip": true,540 "style": ["text"],541 "interactive": false,542 "from": {"data": "data_0"},543 "encode": {544 "update": {545 "dx": {"value": -15},546 "dy": {"value": 3},547 "fill": {"value": "black"},548 "x": {"scale": "concat_0_x", "field": "x_axis"},549 "y": {"scale": "concat_0_y", "field": "y_axis"},550 "text": {"signal": "''+datum[\"original\"]"},551 "align": {"value": "center"},552 "baseline": {"value": "middle"}553 }554 }555 }556 ],557 "axes": [558 {559 "scale": "concat_0_x",560 "orient": "bottom",561 "gridScale": "concat_0_y",562 "grid": true,563 "tickCount": {"signal": "ceil(concat_0_width/40)"},564 "domain": false,565 "labels": false,566 "maxExtent": 0,567 "minExtent": 0,568 "ticks": false,569 "zindex": 0570 },571 {572 "scale": "concat_0_y",573 "orient": "left",574 "gridScale": "concat_0_x",575 "grid": true,576 "tickCount": {"signal": "ceil(height/40)"},577 "domain": false,578 "labels": false,579 "maxExtent": 0,580 "minExtent": 0,581 "ticks": false,582 "zindex": 0583 },584 {585 "scale": "concat_0_x",586 "orient": "bottom",587 "grid": false,588 "title": "Dimension 0",589 "labelFlush": true,590 "labelOverlap": true,591 "tickCount": {"signal": "ceil(concat_0_width/40)"},592 "zindex": 0593 },594 {595 "scale": "concat_0_y",596 "orient": "left",597 "grid": false,598 "title": "Dimension 1",599 "labelOverlap": true,600 "tickCount": {"signal": "ceil(height/40)"},601 "zindex": 0602 }603 ]604 },605 {606 "type": "group",607 "name": "concat_1_group",608 "title": {"text": "Dimension 0 vs. Dimension 1", "frame": "group"},609 "style": "cell",610 "encode": {611 "update": {612 "width": {"signal": "concat_1_width"},613 "height": {"signal": "height"}614 }615 },616 "signals": [617 {618 "name": "selector015_x_axis",619 "on": [620 {621 "events": {"signal": "selector015_translate_delta"},622 "update": "panLinear(selector015_translate_anchor.extent_x, -selector015_translate_delta.x / concat_1_width)"623 },624 {625 "events": {"signal": "selector015_zoom_delta"},626 "update": "zoomLinear(domain(\"concat_1_x\"), selector015_zoom_anchor.x, selector015_zoom_delta)"627 },628 {629 "events": [{"source": "scope", "type": "dblclick"}],630 "update": "null"631 }632 ],633 "push": "outer"634 },635 {636 "name": "selector015_y_axis",637 "on": [638 {639 "events": {"signal": "selector015_translate_delta"},640 "update": "panLinear(selector015_translate_anchor.extent_y, selector015_translate_delta.y / height)"641 },642 {643 "events": {"signal": "selector015_zoom_delta"},644 "update": "zoomLinear(domain(\"concat_1_y\"), selector015_zoom_anchor.y, selector015_zoom_delta)"645 },646 {647 "events": [{"source": "scope", "type": "dblclick"}],648 "update": "null"649 }650 ],651 "push": "outer"652 },653 {654 "name": "selector015_tuple",655 "on": [656 {657 "events": [658 {"signal": "selector015_x_axis || selector015_y_axis"}659 ],660 "update": "selector015_x_axis && selector015_y_axis ? {unit: \"concat_1_layer_0\", fields: selector015_tuple_fields, values: [selector015_x_axis,selector015_y_axis]} : null"661 }662 ]663 },664 {665 "name": "selector015_tuple_fields",666 "value": [667 {"field": "x_axis", "channel": "x", "type": "R"},668 {"field": "y_axis", "channel": "y", "type": "R"}669 ]670 },671 {672 "name": "selector015_translate_anchor",673 "value": {},674 "on": [675 {676 "events": [{"source": "scope", "type": "mousedown"}],677 "update": "{x: x(unit), y: y(unit), extent_x: domain(\"concat_1_x\"), extent_y: domain(\"concat_1_y\")}"678 }679 ]680 },681 {682 "name": "selector015_translate_delta",683 "value": {},684 "on": [685 {686 "events": [687 {688 "source": "window",689 "type": "mousemove",690 "consume": true,691 "between": [692 {"source": "scope", "type": "mousedown"},693 {"source": "window", "type": "mouseup"}694 ]695 }696 ],697 "update": "{x: selector015_translate_anchor.x - x(unit), y: selector015_translate_anchor.y - y(unit)}"698 }699 ]700 },701 {702 "name": "selector015_zoom_anchor",703 "on": [704 {705 "events": [{"source": "scope", "type": "wheel", "consume": true}],706 "update": "{x: invert(\"concat_1_x\", x(unit)), y: invert(\"concat_1_y\", y(unit))}"707 }708 ]709 },710 {711 "name": "selector015_zoom_delta",712 "on": [713 {714 "events": [{"source": "scope", "type": "wheel", "consume": true}],715 "force": true,716 "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))"717 }718 ]719 },720 {721 "name": "selector015_modify",722 "on": [723 {724 "events": {"signal": "selector015_tuple"},725 "update": "modify(\"selector015_store\", selector015_tuple, true)"726 }727 ]728 }729 ],730 "marks": [731 {732 "name": "concat_1_layer_0_marks",733 "type": "symbol",734 "clip": true,735 "style": ["circle"],736 "interactive": true,737 "from": {"data": "data_1"},738 "encode": {739 "update": {740 "opacity": {"value": 0.7},741 "size": {"value": 60},742 "fill": {"value": "#4c78a8"},743 "tooltip": {744 "signal": "{\"name\": ''+datum[\"name\"], \"original\": ''+datum[\"original\"]}"745 },746 "x": {"scale": "concat_1_x", "field": "x_axis"},747 "y": {"scale": "concat_1_y", "field": "y_axis"},748 "shape": {"value": "circle"}749 }750 }751 },752 {753 "name": "concat_1_layer_1_marks",754 "type": "text",755 "clip": true,756 "style": ["text"],757 "interactive": false,758 "from": {"data": "data_1"},759 "encode": {760 "update": {761 "dx": {"value": -15},762 "dy": {"value": 3},763 "fill": {"value": "black"},764 "x": {"scale": "concat_1_x", "field": "x_axis"},765 "y": {"scale": "concat_1_y", "field": "y_axis"},766 "text": {"signal": "''+datum[\"original\"]"},767 "align": {"value": "center"},768 "baseline": {"value": "middle"}769 }770 }771 }772 ],773 "axes": [774 {775 "scale": "concat_1_x",776 "orient": "bottom",777 "gridScale": "concat_1_y",778 "grid": true,779 "tickCount": {"signal": "ceil(concat_1_width/40)"},780 "domain": false,781 "labels": false,782 "maxExtent": 0,783 "minExtent": 0,784 "ticks": false,785 "zindex": 0786 },787 {788 "scale": "concat_1_y",789 "orient": "left",790 "gridScale": "concat_1_x",791 "grid": true,792 "tickCount": {"signal": "ceil(height/40)"},793 "domain": false,794 "labels": false,795 "maxExtent": 0,796 "minExtent": 0,797 "ticks": false,798 "zindex": 0799 },800 {801 "scale": "concat_1_x",802 "orient": "bottom",803 "grid": false,804 "title": "Dimension 0",805 "labelFlush": true,806 "labelOverlap": true,807 "tickCount": {"signal": "ceil(concat_1_width/40)"},808 "zindex": 0809 },810 {811 "scale": "concat_1_y",812 "orient": "left",813 "grid": false,814 "title": "Dimension 1",815 "labelOverlap": true,816 "tickCount": {"signal": "ceil(height/40)"},817 "zindex": 0818 }819 ]820 }821 ],822 "scales": [823 {824 "name": "concat_0_x",825 "type": "linear",826 "domain": {"data": "data_0", "field": "x_axis"},827 "domainRaw": {"signal": "selector014[\"x_axis\"]"},828 "range": [0, {"signal": "concat_0_width"}],829 "nice": true,830 "zero": true831 },832 {833 "name": "concat_0_y",834 "type": "linear",835 "domain": {"data": "data_0", "field": "y_axis"},836 "domainRaw": {"signal": "selector014[\"y_axis\"]"},837 "range": [{"signal": "height"}, 0],838 "nice": true,839 "zero": true840 },841 {842 "name": "concat_1_x",843 "type": "linear",844 "domain": {"data": "data_1", "field": "x_axis"},845 "domainRaw": {"signal": "selector015[\"x_axis\"]"},846 "range": [0, {"signal": "concat_1_width"}],847 "nice": true,848 "zero": true849 },850 {851 "name": "concat_1_y",852 "type": "linear",853 "domain": {"data": "data_1", "field": "y_axis"},854 "domainRaw": {"signal": "selector015[\"y_axis\"]"},855 "range": [{"signal": "height"}, 0],856 "nice": true,857 "zero": true858 }859 ]860}...
interactive1.js
Source:interactive1.js
1var spec1 = {2 "config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},3 "hconcat": [4 {5 "layer": [6 {7 "mark": {"type": "circle", "size": 60},8 "encoding": {9 "tooltip": [10 {"type": "nominal", "field": "name"},11 {"type": "nominal", "field": "original"}12 ],13 "x": {14 "type": "quantitative",15 "axis": {"title": "man"},16 "field": "x_axis"17 },18 "y": {19 "type": "quantitative",20 "axis": {"title": "woman"},21 "field": "y_axis"22 }23 },24 "selection": {25 "selector003": {26 "type": "interval",27 "bind": "scales",28 "encodings": ["x", "y"]29 }30 },31 "title": "man vs. woman"32 },33 {34 "mark": {"type": "text", "color": "black", "dx": -15, "dy": 3},35 "encoding": {36 "text": {"type": "nominal", "field": "original"},37 "x": {38 "type": "quantitative",39 "axis": {"title": "man"},40 "field": "x_axis"41 },42 "y": {43 "type": "quantitative",44 "axis": {"title": "woman"},45 "field": "y_axis"46 }47 }48 }49 ],50 "data": {"name": "data-15774a1af3e17e7d98478860e09ed029"},51 "height": 300,52 "width": 30053 },54 {55 "layer": [56 {57 "mark": {"type": "circle", "size": 60},58 "encoding": {59 "tooltip": [60 {"type": "nominal", "field": "name"},61 {"type": "nominal", "field": "original"}62 ],63 "x": {64 "type": "quantitative",65 "axis": {"title": "(man | (king - queen))"},66 "field": "x_axis"67 },68 "y": {69 "type": "quantitative",70 "axis": {"title": "(woman | (king - queen))"},71 "field": "y_axis"72 }73 },74 "selection": {75 "selector002": {76 "type": "interval",77 "bind": "scales",78 "encodings": ["x", "y"]79 }80 },81 "title": "(man | (king - queen)) vs. (woman | (king - queen))"82 },83 {84 "mark": {"type": "text", "color": "black", "dx": -15, "dy": 3},85 "encoding": {86 "text": {"type": "nominal", "field": "original"},87 "x": {88 "type": "quantitative",89 "axis": {"title": "(man | (king - queen))"},90 "field": "x_axis"91 },92 "y": {93 "type": "quantitative",94 "axis": {"title": "(woman | (king - queen))"},95 "field": "y_axis"96 }97 }98 }99 ],100 "data": {"name": "data-5ef8856a00a327788b3c3840144bb429"},101 "height": 300,102 "width": 300103 }104 ],105 "$schema": "https://vega.github.io/schema/vega-lite/v4.0.2.json",106 "datasets": {107 "data-15774a1af3e17e7d98478860e09ed029": [108 {109 "x_axis": 0.40951526165008545,110 "y_axis": 0.3261851966381073,111 "name": "prince",112 "original": "prince"113 },114 {115 "x_axis": 0.27098548412323,116 "y_axis": 0.4069218039512634,117 "name": "princess",118 "original": "princess"119 },120 {121 "x_axis": 0.3271060585975647,122 "y_axis": 0.5211429595947266,123 "name": "nurse",124 "original": "nurse"125 },126 {127 "x_axis": 0.4489893317222595,128 "y_axis": 0.4943573474884033,129 "name": "doctor",130 "original": "doctor"131 },132 {133 "x_axis": 0.19353565573692322,134 "y_axis": 0.09302382916212082,135 "name": "banker",136 "original": "banker"137 },138 {139 "x_axis": 0.38155144453048706,140 "y_axis": 0.33430397510528564,141 "name": "cousin",142 "original": "cousin"143 },144 {145 "x_axis": 0.29427674412727356,146 "y_axis": 0.41036874055862427,147 "name": "neice",148 "original": "neice"149 },150 {151 "x_axis": 0.45961007475852966,152 "y_axis": 0.27491992712020874,153 "name": "king",154 "original": "king"155 },156 {157 "x_axis": 0.2914373576641083,158 "y_axis": 0.40253907442092896,159 "name": "queen",160 "original": "queen"161 },162 {163 "x_axis": 0.6322574615478516,164 "y_axis": 0.37293168902397156,165 "name": "dude",166 "original": "dude"167 },168 {169 "x_axis": 0.689598560333252,170 "y_axis": 0.4880948066711426,171 "name": "guy",172 "original": "guy"173 },174 {175 "x_axis": 0.30102455615997314,176 "y_axis": 0.3522968888282776,177 "name": "gal",178 "original": "gal"179 },180 {181 "x_axis": 0.4537816643714905,182 "y_axis": 0.31863078474998474,183 "name": "fire",184 "original": "fire"185 },186 {187 "x_axis": 0.4621913731098175,188 "y_axis": 0.4013059139251709,189 "name": "dog",190 "original": "dog"191 },192 {193 "x_axis": 0.3758322596549988,194 "y_axis": 0.34616324305534363,195 "name": "cat",196 "original": "cat"197 },198 {199 "x_axis": 0.2176199108362198,200 "y_axis": 0.18362130224704742,201 "name": "mouse",202 "original": "mouse"203 },204 {205 "x_axis": 0.2972288429737091,206 "y_axis": 0.3045094907283783,207 "name": "red",208 "original": "red"209 },210 {"x_axis": 0, "y_axis": 0, "name": "blue", "original": "blue"},211 {212 "x_axis": 0.25164204835891724,213 "y_axis": 0.215010866522789,214 "name": "green",215 "original": "green"216 },217 {218 "x_axis": 0.2725669741630554,219 "y_axis": 0.25106003880500793,220 "name": "yellow",221 "original": "yellow"222 },223 {224 "x_axis": 0.335124671459198,225 "y_axis": 0.2691221237182617,226 "name": "water",227 "original": "water"228 },229 {230 "x_axis": 0.538722574710846,231 "y_axis": 0.5015737414360046,232 "name": "person",233 "original": "person"234 },235 {236 "x_axis": 0.3436667323112488,237 "y_axis": 0.3416234254837036,238 "name": "family",239 "original": "family"240 },241 {242 "x_axis": 0.5816835165023804,243 "y_axis": 0.39277997612953186,244 "name": "brother",245 "original": "brother"246 },247 {248 "x_axis": 0.3568364381790161,249 "y_axis": 0.4736946225166321,250 "name": "sister",251 "original": "sister"252 }253 ],254 "data-5ef8856a00a327788b3c3840144bb429": [255 {256 "x_axis": 0.3721413016319275,257 "y_axis": 0.37740591168403625,258 "name": "(prince | (king - queen))",259 "original": "prince"260 },261 {262 "x_axis": 0.32078519463539124,263 "y_axis": 0.3907199800014496,264 "name": "(princess | (king - queen))",265 "original": "princess"266 },267 {268 "x_axis": 0.38499051332473755,269 "y_axis": 0.5041420459747314,270 "name": "(nurse | (king - queen))",271 "original": "nurse"272 },273 {274 "x_axis": 0.46731048822402954,275 "y_axis": 0.5102049708366394,276 "name": "(doctor | (king - queen))",277 "original": "doctor"278 },279 {280 "x_axis": 0.1731649786233902,281 "y_axis": 0.11744287610054016,282 "name": "(banker | (king - queen))",283 "original": "banker"284 },285 {286 "x_axis": 0.3942609429359436,287 "y_axis": 0.3473650813102722,288 "name": "(cousin | (king - queen))",289 "original": "cousin"290 },291 {292 "x_axis": 0.3400344252586365,293 "y_axis": 0.39806586503982544,294 "name": "(neice | (king - queen))",295 "original": "neice"296 },297 {298 "x_axis": 0.3779345750808716,299 "y_axis": 0.3594277501106262,300 "name": "(king | (king - queen))",301 "original": "king"302 },303 {304 "x_axis": 0.3779345750808716,305 "y_axis": 0.35942772030830383,306 "name": "(queen | (king - queen))",307 "original": "queen"308 },309 {310 "x_axis": 0.6412995457649231,311 "y_axis": 0.3981958031654358,312 "name": "(dude | (king - queen))",313 "original": "dude"314 },315 {316 "x_axis": 0.6984968185424805,317 "y_axis": 0.5187848806381226,318 "name": "(guy | (king - queen))",319 "original": "guy"320 },321 {322 "x_axis": 0.3681216537952423,323 "y_axis": 0.32252824306488037,324 "name": "(gal | (king - queen))",325 "original": "gal"326 },327 {328 "x_axis": 0.46388524770736694,329 "y_axis": 0.3355717957019806,330 "name": "(fire | (king - queen))",331 "original": "fire"332 },333 {334 "x_axis": 0.47540125250816345,335 "y_axis": 0.4186546504497528,336 "name": "(dog | (king - queen))",337 "original": "dog"338 },339 {340 "x_axis": 0.398105651140213,341 "y_axis": 0.3522307574748993,342 "name": "(cat | (king - queen))",343 "original": "cat"344 },345 {346 "x_axis": 0.22983808815479279,347 "y_axis": 0.187143474817276,348 "name": "(mouse | (king - queen))",349 "original": "mouse"350 },351 {352 "x_axis": 0.3163382112979889,353 "y_axis": 0.30910223722457886,354 "name": "(red | (king - queen))",355 "original": "red"356 },357 {358 "x_axis": 0,359 "y_axis": 0,360 "name": "(blue | (king - queen))",361 "original": "blue"362 },363 {364 "x_axis": 0.26152005791664124,365 "y_axis": 0.2223435342311859,366 "name": "(green | (king - queen))",367 "original": "green"368 },369 {370 "x_axis": 0.29196789860725403,371 "y_axis": 0.253030925989151,372 "name": "(yellow | (king - queen))",373 "original": "yellow"374 },375 {376 "x_axis": 0.34176596999168396,377 "y_axis": 0.2832501232624054,378 "name": "(water | (king - queen))",379 "original": "water"380 },381 {382 "x_axis": 0.5559191107749939,383 "y_axis": 0.5214522480964661,384 "name": "(person | (king - queen))",385 "original": "person"386 },387 {388 "x_axis": 0.3543766736984253,389 "y_axis": 0.35514166951179504,390 "name": "(family | (king - queen))",391 "original": "family"392 },393 {394 "x_axis": 0.5562112927436829,395 "y_axis": 0.4427803158760071,396 "name": "(brother | (king - queen))",397 "original": "brother"398 },399 {400 "x_axis": 0.40646934509277344,401 "y_axis": 0.46244552731513977,402 "name": "(sister | (king - queen))",403 "original": "sister"404 }405 ]406 }407}...
Using AI Code Generation
1x_axis = wpt.x_axis();2y_axis = wpt.y_axis();3z_axis = wpt.z_axis();4x = wpt.x();5y = wpt.y();6z = wpt.z();7x_dir = wpt.x_dir();8y_dir = wpt.y_dir();9z_dir = wpt.z_dir();10x_dir = wpt.x_dir();11y_dir = wpt.y_dir();12z_dir = wpt.z_dir();13x_dir = wpt.x_dir();14y_dir = wpt.y_dir();15z_dir = wpt.z_dir();16x_dir = wpt.x_dir();17y_dir = wpt.y_dir();18z_dir = wpt.z_dir();19x_dir = wpt.x_dir();20y_dir = wpt.y_dir();21z_dir = wpt.z_dir();22x_dir = wpt.x_dir();23y_dir = wpt.y_dir();24z_dir = wpt.z_dir();25x_dir = wpt.x_dir();
Using AI Code Generation
1var wpt = require('wpt');2wpt.x_axis(function(err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = require('wpt');10wpt.y_axis(function(err, data) {11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var wpt = require('wpt');18wpt.z_axis(function(err, data) {19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25var wpt = require('wpt');26wpt.temperature(function(err, data) {27 if (err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33var wpt = require('wpt');34wpt.pressure(function(err, data) {35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var wpt = require('wpt');42wpt.altitude(function(err, data) {43 if (err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49var wpt = require('wpt');50wpt.humidity(function(err, data) {51 if (err) {52 console.log(err);53 } else {54 console.log(data);55 }56});57var wpt = require('wpt');58wpt.battery(function(err, data) {59 if (err) {60 console.log(err);61 } else {62 console.log(data);63 }64});65var wpt = require('wpt');66wpt.battery_level(function(err, data) {67 if (
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3var testOptions = {4};5wpt.runTest(testUrl, testOptions, function(err, data) {6 if (err) return console.log(err);7 console.log('Test Status: ' + data.statusCode);8 console.log('Test ID: ' + data.data.testId);9 console.log('Test URL: ' + data.data.summary);10 console.log('Test Results: ' + data.data.userUrl);11});
Using AI Code Generation
1var wptools = require('wptools');2wptools.page('Albert Einstein').then(function(page) {3 return page.get();4}).then(function(data) {5 console.log(data);6});7var wptools = require('wptools');8wptools.page('Albert Einstein').then(function(page) {9 return page.get();10}).then(function(data) {11 console.log(data);12});
Using AI Code Generation
1var wpt = require('wpt')2wpt.x_axis('test', function(err, data) {3 console.log(data)4})5var wpt = require('wpt')6wpt.y_axis('test', function(err, data) {7 console.log(data)8})9var wpt = require('wpt')10wpt.video('test', function(err, data) {11 console.log(data)12})13var wpt = require('wpt')14wpt.waterfall('test', function(err, data) {15 console.log(data)16})17var wpt = require('wpt')18wpt.waterfall('test', function(err, data) {19 console.log(data)20})21var wpt = require('wpt')22wpt.waterfall('test', function(err, data) {23 console.log(data)24})25var wpt = require('wpt')26wpt.waterfall('test', function(err, data) {27 console.log(data)28})29var wpt = require('wpt')30wpt.waterfall('test', function(err, data) {31 console.log(data)32})33var wpt = require('wpt')34wpt.waterfall('test', function(err, data) {35 console.log(data)36})37var wpt = require('wpt')38wpt.waterfall('test', function(err, data) {39 console.log(data)40})41var wpt = require('wpt')42wpt.waterfall('test', function(err, data) {43 console.log(data)44})
Using AI Code Generation
1var wpt = require('wpt');2var wpt = new wpt('your api key');3wpt.x_axis(function(err, data) {4 console.log(data);5});6var wpt = require('wpt');7var wpt = new wpt('your api key');8wpt.y_axis(function(err, data) {9 console.log(data);10});11var wpt = require('wpt');12var wpt = new wpt('your api key');13wpt.test_info('test id', function(err, data) {14 console.log(data);15});16var wpt = require('wpt');17var wpt = new wpt('your api key');18wpt.test_status('test id', function(err, data) {19 console.log(data);20});21var wpt = require('wpt');22var wpt = new wpt('your api key');23wpt.test_results('test id', function(err, data) {24 console.log(data);25});26var wpt = require('wpt');27var wpt = new wpt('your api key');28wpt.test_results('test id', function(err, data) {29 console.log(data);30});31var wpt = require('wpt');32var wpt = new wpt('your api key');33wpt.test_results('test id', function(err, data) {34 console.log(data);35});36var wpt = require('wpt');37var wpt = new wpt('your api key');38wpt.test_results('test id', function(err, data) {39 console.log(data);40});41var wpt = require('wpt');42var wpt = new wpt('your api key');43wpt.test_results('test id', function(err, data
Using AI Code Generation
1var wpt = require('wpt');2wpt.x_axis(1, 0, 0, 0);3console.log('x_axis called');4var wpt = require('wpt');5wpt.y_axis(1, 0, 0, 0);6console.log('y_axis called');7var wpt = require('wpt');8wpt.z_axis(1, 0, 0, 0);9console.log('z_axis called');10var wpt = require('wpt');11wpt.x_axis(1, 0, 0, 0);12console.log('x_axis called');13var wpt = require('wpt');14wpt.y_axis(1, 0, 0, 0);15console.log('y_axis called');16var wpt = require('wpt');17wpt.z_axis(1, 0, 0, 0);18console.log('z_axis called');19var wpt = require('wpt');20wpt.x_axis(1, 0, 0, 0);21console.log('x_axis called');22var wpt = require('wpt');23wpt.y_axis(1, 0, 0, 0);24console.log('y_axis called');25var wpt = require('wpt');26wpt.z_axis(1, 0, 0, 0);27console.log('z_axis called');28var wpt = require('wpt');29wpt.x_axis(1, 0, 0, 0);30console.log('x_axis called');
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!