From e02b1da0123b5b771ca4f5f09cfb055fd49b07ae Mon Sep 17 00:00:00 2001 From: TheCodeTherapy Date: Wed, 7 Aug 2024 15:38:45 +0100 Subject: [PATCH] updates MML piano example --- .../server/mml-documents/piano.html | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/example/multi-user-3d-web-experience/server/mml-documents/piano.html b/example/multi-user-3d-web-experience/server/mml-documents/piano.html index 741ba626..4224174f 100644 --- a/example/multi-user-3d-web-experience/server/mml-documents/piano.html +++ b/example/multi-user-3d-web-experience/server/mml-documents/piano.html @@ -1,4 +1,4 @@ - + @@ -59,7 +59,7 @@ const keyboard = new Map(); const playerCollisionRemovalSchedule = new Map(); - const collisionRemovalDelay = 250; + const collisionRemovalDelay = 120; const mp3Notes = new Map(); const pressRotation = 1.25; @@ -94,7 +94,7 @@ const now = document.timeline.currentTime; noteObject.note.setAttribute("volume", 3); noteObject.note.setAttribute("start-time", now); - noteObject.note.setAttribute("pause-time", now + 4000); + noteObject.note.setAttribute("pause-time", now + 2000); } function createKey(keyType, xPosition) { @@ -106,7 +106,7 @@ key.setAttribute("id", id); key.setAttribute("src", url); key.setAttribute("x", xPosition); - key.setAttribute("y", keyType === "black" ? -0.2 : 0); + key.setAttribute("y", keyType === "black" ? -0.17 : 0); key.setAttribute("z", keyType === "black" ? 0 : 0); key.setAttribute("collision-interval", 50); pianoKeysGroup.appendChild(key); @@ -240,7 +240,6 @@ createKey(keyType, xPosition); }); - // Create black keys blackKeyPositions.forEach((position, index) => { const offset = blackKeysOffsets[index]; xPosition = octave > 0 ? offset + o * octave : offset; @@ -248,10 +247,9 @@ }); } - // Adding the C6 note after the last octave if (numberOfOctaves > 0) { - const c6Position = o * numberOfOctaves + whiteKeysOffsets[0]; // Calculating the position for the C6 key - createKey("full", c6Position); // Assuming C6 will have the type "white_left" + const c6Position = o * numberOfOctaves + whiteKeysOffsets[0]; + createKey("full", c6Position); } }