- change touch when US/FR selected in lobby page
    - spotLight change when camera tp in home page;
This commit is contained in:
Kum1ta
2024-10-03 03:02:44 +02:00
parent b072b6979f
commit de226bb828
5 changed files with 40 additions and 31 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 23:13:53 by edbernar #+# #+# */
/* Updated: 2024/10/01 02:34:55 by edbernar ### ########.fr */
/* Updated: 2024/10/03 02:33:35 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,11 +16,6 @@ import { files } from '/static/javascript/filesLoader.js';
const loader = new GLTFLoader();
let light = {
point: 1,
};
class Screen
{
scene = null;
@ -63,7 +58,6 @@ class Screen
const vertices = positionAttribute.array;
const material = new THREE.MeshStandardMaterial({color: 0xbbbbbb});
const mesh = new THREE.Mesh(geometry, material);
const pointLight = new THREE.SpotLight(0xffffff, 10 * light.point, 0, Math.PI / 1.6);
for (let i = 0; i < vertices.length; i += 3)
{
@ -79,21 +73,8 @@ class Screen
mesh.rotation.x = Math.PI + 0.05;
mesh.rotation.z = Math.PI;
scene.add(mesh);
pointLight.position.set(-0.05, 1.2, 0.95);
pointLight.castShadow = true;
pointLight.shadow.mapSize.width = 2048;
pointLight.shadow.mapSize.height = 2048;
const targetObject = new THREE.Object3D();
targetObject.position.set(0, 1.2, 0);
pointLight.target = targetObject;
pointLight.target.updateMatrixWorld();
scene.add(pointLight);
this.intervalLight = setInterval(() => {
const intensity = Math.random() * 2 + 10;
pointLight.intensity = intensity * light.point > 13 * light.point ? 13 * light.point : intensity * light.point;
}, 100);
return (mesh);
}
@ -185,4 +166,4 @@ class Screen
};
export { Screen, light };
export { Screen };

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:19:17 by edbernar #+# #+# */
/* Updated: 2024/10/01 02:34:34 by edbernar ### ########.fr */
/* Updated: 2024/10/03 02:39:58 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,7 +16,7 @@ import { BokehPass } from '/static/javascript/three/examples/jsm/postprocessing/
import { GLTFLoader } from '/static/javascript/three/examples/jsm/loaders/GLTFLoader.js';
import { userMeInfo } from "/static/javascript/typeResponse/typeLogin.js";
import * as THREE from '/static/javascript/three/build/three.module.js'
import { Screen, light } from '/static/javascript/home3D/Screen.js'
import { Screen } from '/static/javascript/home3D/Screen.js'
import { files } from '/static/javascript/filesLoader.js';
import { pageRenderer } from '/static/javascript/main.js'
@ -345,7 +345,10 @@ function home3D()
clearInterval(fadeOut);
return;
}
light.point -= 0.2;
if (spotLight.intensity > 0)
spotLight.intensity -= 100;
else
spotLight.intensity = 0;
screen.screen.material.opacity -= 0.05;
if (screen.screen.material.opacity <= 0)
{
@ -362,7 +365,7 @@ function home3D()
clearInterval(fadeInInterval);
return;
}
light.point += 0.2;
spotLight.intensity += 50;
screen.screen.material.opacity += 0.05;
if (screen.screen.material.opacity >= 1)
@ -375,9 +378,10 @@ function home3D()
function completeFade() {
intervalFade = setInterval(() => {
light.point += 0.2;
if (light.point >= 1)
spotLight.intensity += 50;
if (spotLight.intensity >= 1000)
{
spotLight.intensity = 1000;
clearInterval(intervalFade);
isInFade = false;
}

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/25 00:02:19 by edbernar #+# #+# */
/* Updated: 2024/09/23 13:39:50 by edbernar ### ########.fr */
/* Updated: 2024/10/03 02:31:12 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:08:46 by madegryc #+# #+# */
/* Updated: 2024/10/03 00:46:01 by edbernar ### ########.fr */
/* Updated: 2024/10/03 03:00:53 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -346,6 +346,7 @@ function initButtonLaytout()
FRkeys[i].classList.remove('select-keys');
FRkeys[i].classList.add('not-select-keys');
}
changeDisplayedLayout(true);
layoutSelected = {US: true, FR: false};
});
}
@ -359,10 +360,33 @@ function initButtonLaytout()
FRkeys[i].classList.add('select-keys');
FRkeys[i].classList.remove('not-select-keys');
}
changeDisplayedLayout(false);
layoutSelected = {US: false, FR: true};
});
}
}
function changeDisplayedLayout(isUS)
{
const keys = document.getElementsByClassName('keys');
const USkeys = ['W', 'A', 'S', 'D'];
const FRkeys = ['Z', 'Q', 'S', 'D'];
for (let i = 0; i < keys.length; i++)
{
for (let j = 0; j < keys[i].children.length; j++)
{
if (i == 0)
{
if (j == 0)
keys[i].children[j].getElementsByTagName('p')[0].innerText = isUS ? "W" : "Z";
else if (j == 1)
keys[i].children[j].getElementsByTagName('p')[0].innerText = "S"
}
else if (keys[i].children[j].getElementsByTagName('p')[0])
keys[i].children[j].getElementsByTagName('p')[0].innerText = isUS ? USkeys[j] : FRkeys[j];
}
}
}
export { LobbyPage, layoutSelected };

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/01 13:42:29 by edbernar #+# #+# */
/* Updated: 2024/10/03 01:31:12 by edbernar ### ########.fr */
/* Updated: 2024/10/03 02:27:58 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -28,7 +28,7 @@ let divTopInfo = null;
let divInfo = null;
let divChat = null;
// gerer quand une personne finit sa partie pour remettre tout comme il le faut
// gerer quand la personne finit sa partie pour remettre tout comme il le faut
class TournamentPage
{