From aabf06d16b1e36c7f9a830e76b15f78ae8209186 Mon Sep 17 00:00:00 2001 From: Steven Cobb Date: Sat, 19 Oct 2019 06:20:00 -0400 Subject: [PATCH] pre 0.2 release ui changes --- css/bounce.css | 2 +- src/js/Input.js | 25 ++++++++++++++++--------- src/js/Physics.js | 3 ++- src/js/app.js | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/css/bounce.css b/css/bounce.css index f2664ab..abcbe14 100644 --- a/css/bounce.css +++ b/css/bounce.css @@ -182,7 +182,7 @@ button#bounce { animation: fade-in 2.0s 1; animation-fill-mode: forwards; /* animation-delay: 6s; */ - animation-delay: 6s; + animation-delay: 12s; } @keyframes fade-in { diff --git a/src/js/Input.js b/src/js/Input.js index 922be3c..5383cce 100644 --- a/src/js/Input.js +++ b/src/js/Input.js @@ -18,7 +18,8 @@ import Physics from './Physics.js'; // Tone.Transport.clear() -const MIN_NOTE = 48; +// const MIN_NOTE = 36; //Error: `NoteSequence` has a pitch outside of the valid range: 47 +const MIN_NOTE = 48; const MAX_NOTE = 84; let pulsePattern = true; @@ -254,13 +255,19 @@ function machineKeyDown(note = 60, time = 0) { let tonalNote = Tonal.Note.fromMidi(note); let instrMapped = getInstrByInputNote(tonalNote); - // if (instrMapped === undefined && note) { - // console.log('(machineKeyDown) UNDEF -> note: ', note); - // const undefNoteArr = note.split(''); // ERR: note.split is not a function - // note = undefNoteArr[0] + undefNoteArr[2]; - // instrMapped = getInstrByInputNote(note); - // } - + if (instrMapped === undefined && tonalNote.length === 2) { + // console.log('(machineKeyDown) UNDEF -> note: ', note); + console.log('(machineKeyDown) UNDEF -> tonalNote: ', tonalNote); + const undefNoteArr = tonalNote.split(''); // ERR: note.split is not a function - Eb4 + note = undefNoteArr[0] + undefNoteArr[2]; + instrMapped = getInstrByInputNote(note); + } + + if (instrMapped === undefined) { + instrMapped = getInstrByInputNote('C4'); + } + + // console.log('(machineKeyDown) -> instrMapped: ', instrMapped); instrMapped.color = '#ED4A82'; // pink physics.addBody(true, globals.dropPosX, instrMapped); } @@ -392,7 +399,7 @@ function startSequenceGenerator(seed) { } function consumeNext(time) { - console.log('consumeNext -> time: ', time); + // console.log('consumeNext -> time: ', time); if (generatedSequence.length) { console.log('consumeNext -> generatedSequence: ', generatedSequence); let note = generatedSequence.shift(); diff --git a/src/js/Physics.js b/src/js/Physics.js index 21f2662..e0128e9 100644 --- a/src/js/Physics.js +++ b/src/js/Physics.js @@ -125,7 +125,8 @@ export default class Physics { // https://codepen.io/danlong/pen/LJQYYN zPos += 10; // see globals.staffLineInitZ and globals.staffLineSecondZ } else { - zPos -= 10; + // zPos -= 10; //PREV + zPos -= 3; //PREV } // zPos = options.originalPosition.z; diff --git a/src/js/app.js b/src/js/app.js index 18afba4..f821959 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -231,7 +231,7 @@ function addStaffLines(color = 0x000000, offset, posXstart, posXend, posY, posZ, } } -const staffLineLengthEnd = 2000; +const staffLineLengthEnd = 8000; if (globals.keysOnly !== true) { addStaffLines(0x000000, globals.staffLineInitZ, -1000, staffLineLengthEnd, 0.08, 0, 2); } else if (globals.keysOnly === true) {