Created
January 30, 2018 04:54
-
-
Save Muratam/45f199c15a1c6703a998100614c07513 to your computer and use it in GitHub Desktop.
abc-animation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setScore(abc, scoreDOM, midiDOM) { | |
let tunes = ABCJS.renderAbc(scoreDOM, abc, {}, { | |
responsive: 'resize', | |
paddingtop: 0, | |
scale: 1, | |
paddingbottom: 0, | |
}); | |
ABCJS.renderMidi( | |
midiDOM, abc, {}, { | |
program: 25, | |
animate: { | |
target: tunes[0], | |
listener(last, newer) { | |
if (last) { | |
for (const elem of last.elements[0].items) | |
elem[0].setAttribute('fill', '#000'); | |
} | |
if (newer) { | |
for (const elem of newer.elements[0].items) | |
elem[0].setAttribute('fill', '#59d'); | |
} | |
}, | |
} | |
}, | |
{}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment