- Add fade at start of game
This commit is contained in:
Kum1ta
2024-09-08 17:07:16 +02:00
parent 6c6ad4e395
commit 6a9fedd9e2
3 changed files with 27 additions and 11 deletions

View File

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* SoloGame.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/28 12:07:39 by edbernar #+# #+# */
/* Updated: 2024/09/04 17:44:03 by hubourge ### ########.fr */
/* Updated: 2024/09/08 17:02:58 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -38,12 +38,13 @@ class SoloGame
{
static create()
{
// console.log(document.getElementsByTagName('canvas'));
// document.getElementsByTagName('canvas')[3].style.animation = 'fadeIn 0.199s';
// document.getElementsByTagName('canvas')[3].style.filter = 'brightness(0)';
scene = new THREE.Scene();
renderer = new THREE.WebGLRenderer({antialias: true});
renderer.domElement.style.animation = 'fadeOutStart 1s';
renderer.domElement.style.filter = 'brightness(1)';
document.getElementById('score').style.animation = 'fadeOutStart 1s';
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
Ball.create(scene);
@ -64,7 +65,6 @@ class SoloGame
Map.reCreate(true);
})
renderer.setAnimationLoop(loop);
}

View File

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* Map.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/28 12:23:48 by edbernar #+# #+# */
/* Updated: 2024/09/04 17:19:05 by hubourge ### ########.fr */
/* Updated: 2024/09/08 17:04:12 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -128,6 +128,10 @@ class Map
initialZ = vec3.z;vec3.x = 3;
ballBody.velocity.set(vec3.x, vec3.y, vec3.z);
onUpdate = true;
setTimeout(() => {
onUpdate = false;
}, 900);
}
static #collision()

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/20 11:23:41 by edbernar #+# #+# */
/* Updated: 2024/09/03 18:19:30 by edbernar ### ########.fr */
/* Updated: 2024/09/08 17:04:41 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -28,6 +28,18 @@
}
}
@keyframes fadeOutStart {
0% {
filter: brightness(0);
}
70% {
filter: brightness(0);
}
100% {
filter: brightness(1);
}
}
@keyframes fadeInText {
from {
color: rgb(255, 255, 255, 0.1);
@ -51,7 +63,7 @@ body {
padding: 0;
width: 100%;
height: 100%;
user-select: none;
}
#score {