Best JavaScript code snippet using wpt
escenario.js
Source:escenario.js
...13function movePlayer(dentro, nivel) {14 inside = dentro;15 var esfera = document.createElement("a-box");16 document.getElementById("camara").appendChild(esfera);17 setAttributes(esfera, { id: "camara-fader", position: "0 0 -0.3" });18 setAttributes(esfera, { material: "shader:flat; color: black; opacity: 0.0; side: double" });19 esfera.setAttribute("animation", "property: material.opacity; from: 0.0; to: 1.0; dur: 1000;");20 esfera.addEventListener('animationcomplete', function () {21 // Todo negro (cambiar posicion e invertir animacion)22 if (esfera.getAttribute("material")["opacity"] == 1) {23 // Moverse dentro de la oficina24 if (dentro) {25 // Cambiar posicion26 document.getElementById("rig").object3D.position.set(0, 0.2, -15.7);27 document.getElementById("rig").setAttribute("rotation", "0 180 0");28 document.getElementById("camara").object3D.position.set(0, 1.6, 0);29 setTimeout(() => {30 centerPlayer(0, -15.7, "0 180 0");31 }, 100);32 // Modificar escenario33 luzDia();34 borrarEscenarioExterior();35 crearEscenarioInterior();36 // Cambiar controllers/superHands37 editController(false, true); // eliminar controller derecho38 editSuperHand(true, true); // crear superHand derecha39 // Cargar nivel40 nivelActualID = nivel[0];41 nivelActualNombre = nivel[1];42 if (nivelActualID == "prueba-0") loadTutorial();43 else loadNivel();44 }45 // Moverse fuera de la oficina46 else {47 // Cambiar posicion48 document.getElementById("rig").object3D.position.set(0, 0.2, 0);49 document.getElementById("rig").setAttribute("rotation", "0 0 0");50 document.getElementById("camara").object3D.position.set(0, 1.6, 0);51 setTimeout(() => {52 centerPlayer(0, 0, "0 0 0");53 }, 100);54 // Modificar escenario55 resetDropZones();56 borrarEscenarioInterior();57 crearEscenarioExterior();58 // Cambiar controllers/superHands59 editSuperHand(false, true); // eliminar superHand derecha60 editController(true, true); // crear controller derecho61 }62 // Añadir animacion63 esfera.setAttribute("animation", "property: material.opacity; from: 1.0; to: 0.0; dur: 1000;");64 }65 // Todo normal (eliminar la esfera)66 else {67 esfera.remove();68 }69 });70}71// Funcion que crea el escenario de dentro de la oficina72function crearEscenarioInterior() {73 // Cambiar luces74 var foco = document.getElementById("luz-foco");75 setAttributes(foco, { position: "-10 3.5 -23", rotation: "-1 -151 103" });76 setAttributes(foco, { light: "type: spot; angle: 60; intensity: 0.4" });77 var foco2 = document.getElementById("luz-foco2");78 setAttributes(foco2, { light: "type: spot; angle: 60; intensity: 0.4" });79 // Mesa ordenadores 180 var mesa1 = document.createElement("a-entity");81 setAttributes(mesa1, { id: "esc-mesa1", position: "3 0.8 1.5" });82 mesa1.setAttribute("mesa-ordenadores", "");83 // Mesa ordenadores 284 var mesa2 = document.createElement("a-entity");85 setAttributes(mesa2, { id: "esc-mesa2", position: "-3 0.8 1.5" });86 mesa2.setAttribute("mesa-ordenadores", "");87 // Luz 188 var luz1 = document.createElement("a-box");89 setAttributes(luz1, { id: "esc-luzTecho1", position: "3 3.35 1", width: "0.5", height: "0.08" });90 setAttributes(luz1, { depth: "1", src: "#luzTechoTexture", repeat: "1 2" });91 // Luz 292 var luz2 = document.createElement("a-box");93 setAttributes(luz2, { id: "esc-luzTecho2", position: "-3 3.35 1", width: "0.5", height: "0.08" });94 setAttributes(luz2, { depth: "1", src: "#luzTechoTexture", repeat: "1 2" });95 // Luz 396 var luz3 = document.createElement("a-box");97 setAttributes(luz3, { id: "esc-luzTecho3", position: "0 3.35 -3.5", width: "0.5", height: "0.08" });98 setAttributes(luz3, { rotation: "0 90 0", depth: "1", src: "#luzTechoTexture", repeat: "1 2" });99 var mesaMain = document.createElement("a-entity");100 setAttributes(mesaMain, { id: "mesa-trabajo", position: "0.25 0.82 -2.7" });101 // Mesa trabajo: ordenador, componentes y drop zones102 var ordenador = document.createElement("a-entity");103 ordenador.setAttribute("id", "ordenador");104 var o1 = document.createElement("a-box");105 setAttributes(o1, { position: "0 0.1 0", width: "0.01", height: "0.15", depth: "0.49" });106 setAttributes(o1, { multisrc: "src0:#pcBackTexture; src1:#pcBackTexture2; src2:#pcColorTexture" });107 o1.setAttribute("class", "raycastable");108 var o2 = document.createElement("a-box");109 setAttributes(o2, { position: "-0.55 0.1 0", width: "0.01", height: "0.15", depth: "0.49" });110 setAttributes(o2, { multisrc: "src1:#pcFrontTexture; src2:#pcColorTexture; src0:#pcColorTexture" });111 o2.setAttribute("class", "raycastable");112 var o3 = document.createElement("a-box");113 setAttributes(o3, { position: "-0.275 0.1 0.25", width: "0.01", height: "0.15", depth: "0.56" });114 setAttributes(o3, { rotation: "0 90 0", src: "#pcColorTexture", class: "raycastable" });115 var o4 = document.createElement("a-box");116 setAttributes(o4, { position: "-0.275 0.1 -0.25", width: "0.01", height: "0.15", depth: "0.56" });117 setAttributes(o4, { rotation: "0 90 0", color: "#292929", class: "raycastable" });118 var o5 = document.createElement("a-box");119 setAttributes(o5, { position: "-0.275 0.03 0", width: "0.55", height: "0.01", depth: "0.5" });120 setAttributes(o5, { src: "#pcBottomTexture", class: "raycastable" });121 var o6 = document.createElement("a-box");122 setAttributes(o6, { position: "-0.4 0.1 0", width: "0.005", height: "0.1", depth: "0.5" });123 setAttributes(o6, { color: "#3d3d3d", class: "raycastable" });124 var o7 = document.createElement("a-box");125 setAttributes(o7, { position: "-0.075 0.1 0.09", width: "0.005", height: "0.1", depth: "0.15" });126 setAttributes(o7, { rotation: "0 90 0", color: "#3d3d3d", class: "raycastable" });127 var componentes = document.createElement("a-entity");128 setAttributes(componentes, { id: "componentes", position: "-0.25 0.05 0" });129 var dropzones = document.createElement("a-entity");130 setAttributes(dropzones, { id: "drop-zones", position: "-0.25 0.05 0" });131 // Static bodies (si esta en VR)132 if (kbRaycaster != "#cursor") {133 o1.setAttribute("static-body", "shape: box;");134 o2.setAttribute("static-body", "shape: box;");135 o3.setAttribute("static-body", "shape: box;");136 o4.setAttribute("static-body", "shape: box;");137 o5.setAttribute("static-body", "shape: box;");138 o6.setAttribute("static-body", "shape: box;");139 o7.setAttribute("static-body", "shape: box;");140 }141 // Appends142 var interior = document.getElementById("oficina-interior");143 ordenador.appendChild(o1);144 ordenador.appendChild(o2);145 ordenador.appendChild(o3);146 ordenador.appendChild(o4);147 ordenador.appendChild(o5);148 ordenador.appendChild(o6);149 ordenador.appendChild(o7);150 mesaMain.appendChild(ordenador);151 mesaMain.appendChild(componentes);152 mesaMain.appendChild(dropzones);153 interior.appendChild(mesa1);154 interior.appendChild(mesa2);155 interior.appendChild(luz1);156 interior.appendChild(luz2);157 interior.appendChild(luz3);158 interior.appendChild(mesaMain);159}160// Funcion que crea el escenario de fuera de la oficina161function crearEscenarioExterior() {162 // Cambiar luces163 var foco = document.getElementById("luz-foco");164 setAttributes(foco, { position: "5 5.3 10", rotation: "-3 0 0" });165 setAttributes(foco, { light: "type: directional; intensity: 0.7" });166 var foco2 = document.getElementById("luz-foco2");167 setAttributes(foco2, { light: "type: spot; angle: 60; intensity: 0" });168 // Menu principal169 crearMenuPrincipal();170 loadMenuPrincipal();171 var toggle = document.createElement("a-cylinder");172 setAttributes(toggle, { id: "esc-toggleMenu", position: "1 0.5 -0.56", height: "1" });173 setAttributes(toggle, { radius: "0.02", color: "red", class: "raycastable" });174 var boxMain = document.createElement("a-box");175 setAttributes(boxMain, { position: "0 0.5 0", rotation: "45 -75 0", width: "0.3" });176 setAttributes(boxMain, { height: "0.03", depth: "0.25", color: "white", class: "raycastable" });177 var box2 = document.createElement("a-box");178 setAttributes(box2, { position: "0 0 0", width: "0.31", height: "0.02", depth: "0.26" });179 setAttributes(box2, { color: "black", class: "raycastable" });180 var txt0 = document.createElement("a-text");181 setAttributes(txt0, { position: "0 0.02 -0.08", rotation: "-90 0 0", width: "0.7" });182 setAttributes(txt0, { value: "Ocultar/mostrar", color: "black", align: "center" });183 var txt1 = document.createElement("a-text");184 setAttributes(txt1, { position: "-0.11 0.02 -0.01", rotation: "-90 0 0", width: "0.6", value: "Menú", color: "black" });185 txt1.setAttribute("font-open-sans", "");186 var c1 = document.createElement("a-cylinder");187 setAttributes(c1, { position: "0.13 0 0", rotation: "90 0 0", height: "0.001", radius: "0.022", color: "#9c9c9c" });188 var c11 = document.createElement("a-cylinder");189 setAttributes(c11, { position: "0 0.001 0", height: "0.001", radius: "0.02" });190 setAttributes(c11, { color: "#fa9d9d", class: "raycastable", onclick: "borrarMenuTodo()" });191 c11.setAttribute("highlight-ocultar", "");192 c11.setAttribute("hc-sound", "");193 var c2 = document.createElement("a-cylinder");194 setAttributes(c2, { position: "0.2 0 0", rotation: "90 0 0", height: "0.001", radius: "0.022", color: "black" });195 var c21 = document.createElement("a-cylinder");196 setAttributes(c21, { position: "0 0.001 0", height: "0.001", radius: "0.02", color: "#86eba1" });197 setAttributes(c21, { class: "raycastable", onclick: "crearMenuPrincipal(); loadMenuPrincipal()" });198 c21.setAttribute("highlight-mostrar", "");199 c21.setAttribute("hc-sound", "");200 var txt1 = document.createElement("a-text");201 setAttributes(txt1, { position: "-0.11 0.02 -0.01", rotation: "-90 0 0", width: "0.6", value: "Menu", color: "black" });202 var c1 = document.createElement("a-cylinder");203 setAttributes(c1, { position: "0.13 0 0", rotation: "90 0 0", height: "0.001", radius: "0.022", color: "#9c9c9c" });204 var c11 = document.createElement("a-cylinder");205 setAttributes(c11, { position: "0 0.001 0", height: "0.001", radius: "0.02" });206 setAttributes(c11, { color: "#fa9d9d", class: "raycastable", onclick: "borrarMenuTodo()" });207 c11.setAttribute("highlight-ocultar", "");208 c11.setAttribute("hc-sound", "");209 var c2 = document.createElement("a-cylinder");210 setAttributes(c2, { position: "0.2 0 0", rotation: "90 0 0", height: "0.001", radius: "0.022", color: "black" });211 var c21 = document.createElement("a-cylinder");212 setAttributes(c21, { position: "0 0.001 0", height: "0.001", radius: "0.02", color: "#86eba1" });213 setAttributes(c21, { class: "raycastable", onclick: "crearMenuPrincipal(); loadMenuPrincipal()" });214 c21.setAttribute("highlight-mostrar", "");215 c21.setAttribute("hc-sound", "");216 var txt2 = document.createElement("a-text");217 setAttributes(txt2, { position: "-0.11 0.02 0.05", rotation: "-90 0 0", width: "0.6", value: "Luces", color: "black" });218 var c3 = document.createElement("a-cylinder");219 setAttributes(c3, { position: "0.13 0 0", rotation: "90 0 0", height: "0.001", radius: "0.022", color: "#9c9c9c" });220 var c31 = document.createElement("a-cylinder");221 setAttributes(c31, { position: "0 0.001 0", height: "0.001", radius: "0.02" });222 setAttributes(c31, { color: "#fa9d9d", class: "raycastable", onclick: "luzNoche()" });223 c31.setAttribute("highlight-ocultar", "");224 c31.setAttribute("hc-sound", "");225 var c4 = document.createElement("a-cylinder");226 setAttributes(c4, { position: "0.2 0 0", rotation: "90 0 0", height: "0.001", radius: "0.022", color: "black" });227 var c41 = document.createElement("a-cylinder");228 setAttributes(c41, { position: "0 0.001 0", height: "0.001", radius: "0.02", color: "#86eba1" });229 setAttributes(c41, { class: "raycastable", onclick: "luzDia()" });230 c41.setAttribute("highlight-mostrar", "");231 c41.setAttribute("hc-sound", "");232 // Añadidos suelo233 var s1 = document.createElement("a-box");234 setAttributes(s1, { position: "-4 -0.1 5.2", width: "6", height: "0.15", depth: "0.4" });235 setAttributes(s1, { color: "#9d9e9e", class: "raycastable" });236 var s2 = document.createElement("a-box");237 setAttributes(s2, { position: "4 -0.1 5.2", width: "6", height: "0.15", depth: "0.4" });238 setAttributes(s2, { color: "#9d9e9e", class: "raycastable" });239 var s3 = document.createElement("a-box");240 setAttributes(s3, { position: "-7.2 -0.1 0", width: "0.4", height: "0.15", depth: "10.8" });241 setAttributes(s3, { color: "#9d9e9e", class: "raycastable" });242 var s4 = document.createElement("a-box");243 setAttributes(s4, { position: "7.2 -0.1 0", width: "0.4", height: "0.15", depth: "10.8" });244 setAttributes(s4, { color: "#9d9e9e", class: "raycastable" });245 var s5 = document.createElement("a-box");246 setAttributes(s5, { position: "0 -0.1 -5.2", width: "14", height: "0.15", depth: "0.4" });247 setAttributes(s5, { color: "#9d9e9e", class: "raycastable" });248 // Añadidos techo249 var t1 = document.createElement("a-box");250 setAttributes(t1, { position: "0 0.1 5.2", width: "14", height: "0.3", depth: "0.4" });251 setAttributes(t1, { color: "#9d9e9e", class: "raycastable" });252 var t2 = document.createElement("a-box");253 setAttributes(t2, { position: "0 0.1 -5.2", width: "14", height: "0.3", depth: "0.4" });254 setAttributes(t2, { color: "#9d9e9e", class: "raycastable" });255 var t3 = document.createElement("a-box");256 setAttributes(t3, { position: "7.2 0.1 0", width: "0.4", height: "0.3", depth: "10.8" });257 setAttributes(t3, { color: "#9d9e9e", class: "raycastable" });258 var t4 = document.createElement("a-box");259 setAttributes(t4, { position: "-7.2 0.1 0", width: "0.4", height: "0.3", depth: "10.8" });260 setAttributes(t4, { color: "#9d9e9e", class: "raycastable" });261 var t5 = document.createElement("a-box");262 setAttributes(t5, { position: "0 0.4 5.45", width: "4.5", height: "0.9", depth: "0.05" });263 setAttributes(t5, { color: "#9fc99f", class: "raycastable" });264 var l1 = document.createElement("a-box");265 setAttributes(l1, { position: "0 0 -0.02", color: "black", width: "4.6" });266 setAttributes(l1, { height: "1", depth: "0.05", class: "raycastable" });267 var l2 = document.createElement("a-plane");268 setAttributes(l2, { position: "-1.75 0 0.03", width: "0.9", height: "0.9" });269 setAttributes(l2, { src: "#letreroTexture", transparent: "true" });270 var l3 = document.createElement("a-entity");271 setAttributes(l3, { position: "2.8 -0.28 0.03", scale: "8 8 8" });272 l3.setAttribute("text", "value:PC Repair Center; color:black; shader: msdf; font:https://raw.githubusercontent.com/etiennepinchon/aframe-fonts/master/fonts/concertone/ConcertOne-Regular.json;");273 // Appends274 c1.appendChild(c11);275 c2.appendChild(c21);276 c3.appendChild(c31);277 c4.appendChild(c41);278 txt1.appendChild(c1);279 txt1.appendChild(c2);280 txt2.appendChild(c3);281 txt2.appendChild(c4);282 boxMain.appendChild(box2);283 boxMain.appendChild(txt0);284 boxMain.appendChild(txt1);285 boxMain.appendChild(txt2);...
AttributeCreator.js
Source:AttributeCreator.js
1function AttributeCreator() {}2AttributeCreator.prototype.create = function() {3 //id, hp, damageReceived, damageDealtMultiplier4 TopLevel.attributesGetter.setAttributes("Ship", 10, 1, 10);5 TopLevel.attributesGetter.setAttributes("Ship", 10, 1, 10);6 TopLevel.attributesGetter.setAttributes("Ship", 10, 1, 10);7 TopLevel.attributesGetter.setAttributes("PartnerShip", 10, 1, 10);8 TopLevel.attributesGetter.setAttributes("PartnerShip", 10, 1, 10);9 TopLevel.attributesGetter.setAttributes("PartnerShip", 10, 1, 10);10 11 TopLevel.attributesGetter.setAttributes("PowerShip", 10, 1, 10);12 TopLevel.attributesGetter.setAttributes("PowerShip", 10, 1, 10);13 TopLevel.attributesGetter.setAttributes("PowerShip", 10, 1, 10);14 TopLevel.attributesGetter.setAttributes("IntroBadGuy", 100, 1, 10);15 TopLevel.attributesGetter.setAttributes("Middle_1_BadGuy", 20, 1, 10);16 TopLevel.attributesGetter.setAttributes("Middle_2_BadGuy", 20, 1, 10);17 TopLevel.attributesGetter.setAttributes("Middle_3_BadGuy", 20, 1, 10);18 TopLevel.attributesGetter.setAttributes("End_1_BadGuy", 25, 1, 10);19 TopLevel.attributesGetter.setAttributes("End_2_BadGuy", 25, 1, 10);20 TopLevel.attributesGetter.setAttributes("End_2_BadGuy", 25, 1, 10);21 TopLevel.attributesGetter.setAttributes("End_2_BadGuy", 25, 1, 10);22 TopLevel.attributesGetter.setAttributes("End_2_BadGuy", 25, 1, 10);23 TopLevel.attributesGetter.setAttributes("End_2_BadGuy", 25, 1, 10);24 TopLevel.attributesGetter.setAttributes("CloneShip", 10, 3, 10);25 TopLevel.attributesGetter.setAttributes("CargoShip", 10, 1, 10);26 TopLevel.attributesGetter.setAttributes("BadGuyArmourPiece_Right", 1, 0, 10);27 TopLevel.attributesGetter.setAttributes("BadGuyArmourPiece_Left", 1, 0, 10);28 TopLevel.attributesGetter.setAttributes("Small_Shot", 0, 0, 0.5);29 TopLevel.attributesGetter.setAttributes("Big_Shot", 0, 0, 0.6);30 TopLevel.attributesGetter.setAttributes("Clone_Small_Shot", 0, 0, 3);31 TopLevel.attributesGetter.setAttributes("Clone_Big_Shot", 0, 0, 3);32 TopLevel.attributesGetter.setAttributes("Single_Power_Shot_1", 50, 1, 2.0);33 TopLevel.attributesGetter.setAttributes("Single_Power_Shot_2", 50, 1, 3.0);34 TopLevel.attributesGetter.setAttributes("Single_Power_Shot_3", 50, 1, 4.0);35 TopLevel.attributesGetter.setAttributes("Double_Power_Shot_1", 50, 1, 1.0);36 TopLevel.attributesGetter.setAttributes("Double_Power_Shot_2", 50, 1, 1.5);37 TopLevel.attributesGetter.setAttributes("Double_Power_Shot_3", 50, 1, 2.0);38 TopLevel.attributesGetter.setAttributes("Triple_Power_Shot_1", 50, 1, 0.66);39 TopLevel.attributesGetter.setAttributes("Triple_Power_Shot_2", 50, 1, 1.0);40 TopLevel.attributesGetter.setAttributes("Triple_Power_Shot_3", 50, 1, 1.33);41 TopLevel.attributesGetter.setAttributes("SmallSwarmRocket", 0, 0, 0.8);42 TopLevel.attributesGetter.setAttributes("LargeSwarmRocket", 0, 0, 0.9);43 TopLevel.attributesGetter.setAttributes("ClusterSwarmRocket", 0, 0, 0.5);44 TopLevel.attributesGetter.setAttributes("MicroHomingRocket", 0, 0, 3);45 TopLevel.attributesGetter.setAttributes("SmallHomingRocket", 0, 0, 3);46 TopLevel.attributesGetter.setAttributes("LargeHomingRocket", 0, 0, 3);47 TopLevel.attributesGetter.setAttributes("Explosion_Damage", 50, 1, 0.1);48 TopLevel.attributesGetter.setAttributes("Explosion_Effect", 0, 0, 0);49 TopLevel.attributesGetter.setAttributes("Debry", 0, 0, 0.4);50 // hp, total HP51 // damageReceived, damage on hit52 // damageDealtMultiplier, multiplier appliued to the other object53 // additionalProperties54 TopLevel.attributesGetter.setAttributes("Boss_1_A", 30, 1, 10);55 TopLevel.attributesGetter.setAttributes("Boss_1_A", 30, 1, 10);56 TopLevel.attributesGetter.setAttributes("Boss_1_A", 30, 1, 10);57 TopLevel.attributesGetter.setAttributes("Boss_1_B", 40, 1, 10);58 TopLevel.attributesGetter.setAttributes("Boss_1_B", 40, 1, 10);59 TopLevel.attributesGetter.setAttributes("Boss_1_B", 40, 1, 10);60 TopLevel.attributesGetter.setAttributes("Boss_1_C", 30, 1, 10);61 TopLevel.attributesGetter.setAttributes("Boss_1_C", 50, 1, 10);62 TopLevel.attributesGetter.setAttributes("Boss_1_C", 20, 1, 10);63 TopLevel.attributesGetter.setAttributes("Boss_1_C", 50, 1, 10);64 TopLevel.attributesGetter.setAttributes("Boss_1_D", 60, 1, 10);65 TopLevel.attributesGetter.setAttributes("Boss_1_D", 60, 1, 10);66 TopLevel.attributesGetter.setAttributes("Boss_1_D", 60, 1, 10);67 TopLevel.attributesGetter.setAttributes("Boss_1_E", 40, 1, 10);68 TopLevel.attributesGetter.setAttributes("Boss_1_E", 40, 1, 10);69 TopLevel.attributesGetter.setAttributes("Boss_1_E", 100, 1, 10);70 TopLevel.attributesGetter.setAttributes("Boss_1_E", 250, 1, 10);71 TopLevel.attributesGetter.setAttributes("Boss_1_F", 50, 1, 10);72 TopLevel.attributesGetter.setAttributes("Boss_1_F", 50, 1, 10);73 TopLevel.attributesGetter.setAttributes("Boss_1_F", 100, 1, 10);74 TopLevel.attributesGetter.setAttributes("Boss_1_F", 100, 1, 10);75 TopLevel.attributesGetter.setAttributes("Boss_1_Helper_Beam_1", 20, 1, 10);76 TopLevel.attributesGetter.setAttributes("Boss_1_Helper_Sniper_1", 20, 1, 10);77 TopLevel.attributesGetter.setAttributes("Boss_1_Helper_Sniper_2", 20, 1, 10);78 TopLevel.attributesGetter.setAttributes("Boss_1_Helper_Multi_1", 20, 1, 10);79 TopLevel.attributesGetter.setAttributes("Boss_1_Helper_Multi_2", 20, 1, 10);80 TopLevel.attributesGetter.setAttributes("SubBoss_1", 40, 1, 10);81 TopLevel.attributesGetter.setAttributes("SubBoss_2", 50, 1, 10);82 TopLevel.attributesGetter.setAttributes("SubBoss_3", 60, 1, 10);83 TopLevel.attributesGetter.setAttributes("Tentacle", 50, 1, 10);84 TopLevel.attributesGetter.setAttributes("Tentacle", 50, 1, 10);85 TopLevel.attributesGetter.setAttributes("Tentacle", 50, 1, 10);86 TopLevel.attributesGetter.setAttributes("WeakTentacle", 20, 1, 10);87 TopLevel.attributesGetter.setAttributes("WeakTentacle", 20, 1, 10);88 TopLevel.attributesGetter.setAttributes("WeakTentacle", 20, 1, 10);89 TopLevel.attributesGetter.setAttributes("LongTentacle", 100, 0.1, 10);90 TopLevel.attributesGetter.setAttributes("LongTentacle", 100, 0.1, 10);91 TopLevel.attributesGetter.setAttributes("LongTentacle", 100, 0.1, 10);92 TopLevel.attributesGetter.setAttributes("BabyTentacle", 100, 0.1, 10);93 TopLevel.attributesGetter.setAttributes("TentacleSegment_Collide", 1, 0, 5);94 TopLevel.attributesGetter.setAttributes("BeamCollider", 1, 0, 1);95 TopLevel.attributesGetter.setAttributes("BeamCollider_PowerBeam", 1, 0, 1);96 TopLevel.attributesGetter.setAttributes("Fireball", 0, 0, 1);97 TopLevel.attributesGetter.setAttributes("MultiShot", 0, 0, 5);98 TopLevel.attributesGetter.setAttributes("BadGuySmallAimedRocket", 0, 0, 3);99 TopLevel.attributesGetter.setAttributes("BadGuyLargeHomingRocket", 0, 0, 5);100 TopLevel.attributesGetter.setAttributes("BadGuyClusterAimedRocket", 0, 0, 3);101 TopLevel.attributesGetter.setAttributes("LastBadGuyLargeHomingRocket", 10, 1, 2);102 // hp, total HP103 // damageReceived, damage on hit104 // damageDealtMultiplier, multiplier appliued to the other object105 // additionalProperties106 TopLevel.attributesGetter.setAttributes("Small_EnemyRocket_1", 0, 0, 3);107 TopLevel.attributesGetter.setAttributes("Small_EnemyRocket_2", 0, 0, 3);108 TopLevel.attributesGetter.setAttributes("Small_EnemyRocket_3", 1, 2, 3);109 TopLevel.attributesGetter.setAttributes("Mid_EnemyRocket_1", 1, 1, 5);110 TopLevel.attributesGetter.setAttributes("Mid_EnemyRocket_2", 1, 1, 5);111 TopLevel.attributesGetter.setAttributes("Mid_EnemyRocket_3", 2, 1, 5);112 TopLevel.attributesGetter.setAttributes("Large_EnemyRocket_1", 2, 1, 10);113 TopLevel.attributesGetter.setAttributes("Large_EnemyRocket_2", 2, 1, 10);114 TopLevel.attributesGetter.setAttributes("Large_EnemyRocket_3", 2, 1, 10);...
Products.js
Source:Products.js
1import { createElements, setAttributes } from '../utils/funcions.js'2export function Products() {3 const ul = createElements('ul')4 setAttributes(ul, 'class', 'main-produtos')5 const products = {6 product1: "../src/assets/img/1.png",7 product2: "../src/assets/img/2.png",8 product3: "../src/assets/img/3.png",9 product4: "../src/assets/img/4.png",10 product5: "../src/assets/img/5.png",11 product6: "../src/assets/img/6.png",12 product7: "../src/assets/img/7.png",13 product8: "../src/assets/img/8.png"14 }15 const style = "width: 250px; height: 150px;"16 const l1 = createElements('li')17 setAttributes(l1, 'id', 'produto-1')18 setAttributes(l1, 'class', 'produtos')19 const a1 = createElements('a')20 setAttributes(a1, 'href', '#')21 const img1 = createElements('img')22 setAttributes(img1, 'src', products.product1)23 setAttributes(img1, 'style', style)24 a1.appendChild(img1)25 l1.appendChild(a1)26 ul.appendChild(l1)27 28 const l2 = createElements('li')29 setAttributes(l2, 'id', 'produto-2')30 setAttributes(l2, 'class', 'produtos')31 const a2 = createElements('a')32 setAttributes(a2, 'href', '#')33 const img2 = createElements('img')34 setAttributes(img2, 'src', products.product2)35 setAttributes(img2, 'style', style)36 a2.appendChild(img2)37 l2.appendChild(a2)38 ul.appendChild(l2)39 const l3 = createElements('li')40 setAttributes(l3, 'id', 'produto-3')41 setAttributes(l3, 'class', 'produtos')42 const a3 = createElements('a')43 setAttributes(a3, 'href', '#')44 const img3 = createElements('img')45 setAttributes(img3, 'src', products.product3)46 setAttributes(img3, 'style', style)47 a3.appendChild(img3)48 l3.appendChild(a3)49 ul.appendChild(l3)50 const l4 = createElements('li')51 setAttributes(l4, 'id', 'produto-4')52 setAttributes(l4, 'class', 'produtos')53 const a4 = createElements('a')54 setAttributes(a4, 'href', '#')55 const img4 = createElements('img')56 setAttributes(img4, 'src', products.product4)57 setAttributes(img4, 'style', style)58 a4.appendChild(img4)59 l4.appendChild(a4)60 ul.appendChild(l4)61 const l5 = createElements('li')62 setAttributes(l5, 'id', 'produto-5')63 setAttributes(l5, 'class', 'produtos')64 const a5 = createElements('a')65 setAttributes(a5, 'href', '#')66 const img5 = createElements('img')67 setAttributes(img5, 'src', products.product5)68 setAttributes(img5, 'style', style)69 a5.appendChild(img5)70 l5.appendChild(a5)71 ul.appendChild(l5)72 const l6 = createElements('li')73 setAttributes(l6, 'id', 'produto-6')74 setAttributes(l6, 'class', 'produtos')75 const a6 = createElements('a')76 setAttributes(a6, 'href', '#')77 const img6 = createElements('img')78 setAttributes(img6, 'src', products.product6)79 setAttributes(img6, 'style', style)80 a6.appendChild(img6)81 l6.appendChild(a6)82 ul.appendChild(l6)83 const l7 = createElements('li')84 setAttributes(l7, 'id', 'produto-7')85 setAttributes(l7, 'class', 'produtos')86 const a7 = createElements('a')87 setAttributes(a7, 'href', '#')88 const img7 = createElements('img')89 setAttributes(img7, 'src', products.product7)90 setAttributes(img7, 'style', style)91 a7.appendChild(img7)92 l7.appendChild(a7)93 ul.appendChild(l7)94 const l8 = createElements('li')95 setAttributes(l8, 'id', 'produto-8')96 setAttributes(l8, 'class', 'produtos')97 const a8 = createElements('a')98 setAttributes(a8, 'href', '#')99 const img8 = createElements('img')100 setAttributes(img8, 'src', products.product8)101 setAttributes(img8, 'style', style)102 103 a8.appendChild(img8)104 l8.appendChild(a8)105 ul.appendChild(l8)106 return ul...
Using AI Code Generation
1var wptools = require('wptools');2var page = wptools.page('Albert Einstein');3page.setAttributes({4});5page.get(function(err, resp) {6 console.log(resp);7});8### page(options)
Using AI Code Generation
1tinymce.PluginManager.add('test', function(editor) {2 editor.addButton('test', {3 onclick: function() {4 editor.insertContent('Hello world!');5 }6 });7});
Using AI Code Generation
1var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];2wptbElement.setAttributes( { 'data-wptb-el': 'table' } );3var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];4wptbElement.setAttributes( { 'data-wptb-el': 'table' } );5var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];6wptbElement.setAttributes( { 'data-wptb-el': 'table' } );7var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];8wptbElement.setAttributes( { 'data-wptb-el': 'table' } );9var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];10wptbElement.setAttributes( { 'data-wptb-el': 'table' } );11var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];12wptbElement.setAttributes( { 'data-wptb-el': 'table' } );13var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];14wptbElement.setAttributes( { 'data-wptb-el': 'table' } );15var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];16wptbElement.setAttributes( { 'data-wptb-el': 'table' } );17var wptbElement = document.getElementsByClassName( 'wptb-element' )[0];18wptbElement.setAttributes( { 'data-wptb-el': 'table' } );
Using AI Code Generation
1var wpt = new WebPageTest('www.webpagetest.org');2wpt.setAttributes({location: 'Dulles:Chrome', connectivity: 'DSL', runs: 3});3 if (err) return console.error(err);4 console.log(data);5});6var wpt = new WebPageTest('www.webpagetest.org');7wpt.setAttribute('runs', 3);8 if (err) return console.error(err);9 console.log(data);10});11var wpt = new WebPageTest('www.webpagetest.org');12wpt.getLocations(function(err, data) {13 if (err) return console.error(err);14 console.log(data);15});16var wpt = new WebPageTest('www.webpagetest.org');17wpt.getTesters(function(err, data) {18 if (err) return console.error(err);19 console.log(data);20});21var wpt = new WebPageTest('www.webpagetest.org');22wpt.getLocations(function(err, data) {23 if (err) return console.error(err);24 console.log(data);25});26var wpt = new WebPageTest('www.webpagetest.org
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!!