Skip to content

Instantly share code, notes, and snippets.

@Muratam
Created January 30, 2018 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Muratam/45f199c15a1c6703a998100614c07513 to your computer and use it in GitHub Desktop.
Save Muratam/45f199c15a1c6703a998100614c07513 to your computer and use it in GitHub Desktop.
abc-animation.js
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