ambiance stop
This commit is contained in:
parent
da7869d31d
commit
4f011d2c85
11
main.js
11
main.js
@ -414,10 +414,19 @@ document.addEventListener( 'keyup', ( event ) => {
|
||||
container.addEventListener( 'mousedown', () => {
|
||||
|
||||
document.body.requestPointerLock();
|
||||
ambiance.play()
|
||||
|
||||
} );
|
||||
|
||||
function lockChangeAlert() {
|
||||
if (document.pointerLockElement === document.body) {
|
||||
ambiance.play()
|
||||
} else {
|
||||
ambiance.pause()
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("pointerlockchange", lockChangeAlert, false);
|
||||
|
||||
document.body.addEventListener( 'mousemove', ( event ) => {
|
||||
|
||||
if ( document.pointerLockElement === document.body ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user