css
This commit is contained in:
parent
d5f6f0baee
commit
70dd803ab0
@ -9,7 +9,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
<span id="end">Libre</span>
|
<span id="message">Libre !</span>
|
||||||
|
|
||||||
<!-- Import maps polyfill -->
|
<!-- Import maps polyfill -->
|
||||||
<!-- Remove this when import maps will be widely supported -->
|
<!-- Remove this when import maps will be widely supported -->
|
||||||
|
14
main.js
14
main.js
@ -394,7 +394,7 @@ const playerDirection = new THREE.Vector3();
|
|||||||
|
|
||||||
let playerOnFloor = false;
|
let playerOnFloor = false;
|
||||||
let jumping = false;
|
let jumping = false;
|
||||||
let escaped = false;
|
let stopAnimation = false;
|
||||||
|
|
||||||
const keyStates = {};
|
const keyStates = {};
|
||||||
|
|
||||||
@ -451,9 +451,9 @@ function onWindowResize() {
|
|||||||
|
|
||||||
function playerCollisions() {
|
function playerCollisions() {
|
||||||
|
|
||||||
if ( !escaped && raftOctree.capsuleIntersect( playerCollider ) ) {
|
if ( !stopAnimation && raftOctree.capsuleIntersect( playerCollider ) ) {
|
||||||
|
|
||||||
end.className = "escaped";
|
message.className = "escaped";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,8 +478,10 @@ function playerCollisions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addEventListener("animationend", (event) => {
|
addEventListener("animationend", (event) => {
|
||||||
escaped = true;
|
|
||||||
|
stopAnimation = true;
|
||||||
document.exitPointerLock();
|
document.exitPointerLock();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -580,8 +582,6 @@ function teleportPlayerIfOob() {
|
|||||||
camera.position.copy( playerCollider.end );
|
camera.position.copy( playerCollider.end );
|
||||||
camera.rotation.set( 0, 0, 0 );
|
camera.rotation.set( 0, 0, 0 );
|
||||||
|
|
||||||
escaped = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -632,6 +632,6 @@ function animate() {
|
|||||||
|
|
||||||
if ( showStats ) stats.update();
|
if ( showStats ) stats.update();
|
||||||
|
|
||||||
if ( !escaped ) requestAnimationFrame( animate );
|
if ( !stopAnimation ) requestAnimationFrame( animate );
|
||||||
|
|
||||||
}
|
}
|
15
style.css
15
style.css
@ -9,7 +9,7 @@ body {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
#container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
@ -23,8 +23,12 @@ canvas {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#end {
|
#message {
|
||||||
display: none;
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#message.escaped {
|
||||||
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -33,14 +37,11 @@ canvas {
|
|||||||
font-family: Georgia, serif;
|
font-family: Georgia, serif;
|
||||||
color: gray;
|
color: gray;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#end.escaped {
|
|
||||||
display: flex;
|
|
||||||
animation: escaped 5s;
|
animation: escaped 5s;
|
||||||
height: 50vh;
|
height: 50vh;
|
||||||
padding-top: 50vh;
|
padding-top: 50vh;
|
||||||
opacity: 100%;
|
opacity: 100%;
|
||||||
background: white;
|
background: white;
|
||||||
|
cursor: default;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user