Add NPS(MAX) function, click to reset individual stats.
This commit is contained in:
parent
f77e81ec6c
commit
7d3cde5a53
3 changed files with 25 additions and 7 deletions
|
@ -28,6 +28,7 @@ let notesThisFrame = 0;
|
|||
let totalNotesPlayed = 0;
|
||||
let shortTermTotal = new Array(60).fill(0);
|
||||
let legatoHistory = new Array(60).fill(0);
|
||||
let notesSMax = 0;
|
||||
let totalIntensityScore = 0;
|
||||
|
||||
// for key pressed counter
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<!-- Our sketch will go here! -->
|
||||
</div>
|
||||
<span style="font-size: 11px;">
|
||||
TIME:使用時間 | NOTE COUNT:總彈奏音符數 | NOTES/S:最近一秒鐘彈奏音符數 | LEGATO:圓滑指數(最近一秒鐘平均來說有幾個鍵被同時按住) <br />
|
||||
TIME:使用時間 | NOTE COUNT:總彈奏音符數 | NPS:最近一秒鐘彈奏音符數(括號為歷史最大值) | LEGATO:圓滑指數(最近一秒鐘平均來說有幾個鍵被同時按住) <br />
|
||||
CALORIES:消耗熱量(估計值,好玩就好)| KEYS:現在正在被按住或被踏板留住的音 | PEDALS:左右踏板深度顯示 <br />
|
||||
(密技:點鍵盤最左上角的角落,可以儲存截圖) <br /><br />
|
||||
</span>
|
||||
|
|
|
@ -117,7 +117,7 @@ function drawTexts() {
|
|||
|
||||
// NOTES
|
||||
let notesText = "NOTE COUNT" + "\n" + totalNotesPlayed;
|
||||
text(notesText, 95, 79);
|
||||
text(notesText, 85, 79);
|
||||
|
||||
// CALORIES
|
||||
let caloriesText = "CALORIES" + "\n" + (totalIntensityScore/250).toFixed(3); // 250 Intensity = 1 kcal.
|
||||
|
@ -125,14 +125,15 @@ function drawTexts() {
|
|||
|
||||
// SHORT-TERM DENSITY
|
||||
let shortTermDensity = shortTermTotal.reduce((accumulator, currentValue) => accumulator + currentValue, 0); // Sum the array.
|
||||
let shortTermDensityText = "NOTES/S" + "\n" + shortTermDensity;
|
||||
text(shortTermDensityText, 200, 79);
|
||||
if (shortTermDensity > notesSMax) { notesSMax = shortTermDensity };
|
||||
let shortTermDensityText = "NPS(MAX)" + "\n" + shortTermDensity + " (" + notesSMax + ")";
|
||||
text(shortTermDensityText, 190, 79);
|
||||
|
||||
// LEGATO SCORE
|
||||
let legatoScore = legatoHistory.reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
||||
legatoScore /= 60;
|
||||
let legatoText = "LEGATO" + "\n" + legatoScore.toFixed(2);
|
||||
text(legatoText, 280, 79);
|
||||
text(legatoText, 276, 79);
|
||||
|
||||
// NOW PLAYING
|
||||
let nowPlayingText = "KEYS" + "\n" + truncateString(getPressedKeys(), 47);
|
||||
|
@ -143,8 +144,6 @@ function pushHistories() {
|
|||
shortTermTotal.push(notesThisFrame);
|
||||
shortTermTotal.shift();
|
||||
notesThisFrame = 0;
|
||||
|
||||
|
||||
legatoHistory.push(isKeyOn.reduce((accumulator, currentValue) => accumulator + currentValue, 0));
|
||||
legatoHistory.shift();
|
||||
|
||||
|
@ -219,4 +218,22 @@ function mouseClicked() {
|
|||
if (mouseX < 50 && mouseY < 50) {
|
||||
saveCanvas('nicechord-pianometer', 'png');
|
||||
}
|
||||
if (mouseY > 76) {
|
||||
if (mouseX <= 84) {
|
||||
sessionStartTime = new Date();
|
||||
}
|
||||
|
||||
if (mouseX > 84 && mouseX < 170) {
|
||||
totalNotesPlayed = 0;
|
||||
}
|
||||
|
||||
if (mouseX > 187 && mouseX < 257) {
|
||||
notesSMax = 0;
|
||||
}
|
||||
|
||||
if (mouseX > 347 && mouseX < 420) {
|
||||
totalIntensityScore = 0; // RESET CALORIES
|
||||
}
|
||||
}
|
||||
console.log(mouseX, mouseY);
|
||||
}
|
Loading…
Reference in a new issue