const black = "#000000";
var context;
var notes = [];
var currNote = 0;
function drawnote() {
if (currNote >= notes.length) {
window.clearInterval(); // Stop the interval when all notes are drawn
return;
}
let note = notes[currNote++];
note.setStyle({ fillStyle: black, strokeStyle: black });
const group = context.openGroup();
group.classList.add("fade-in");
note.draw();
context.closeGroup();
}
window.onload = function() {
setInterval(drawnote, 1000); // Calls yourMethod every 1000ms (1 second)
};
/* global VexFlow */
VexFlow.loadFonts('Bravura', 'Academico').then(() => {
VexFlow.setFonts('Bravura', 'Academico');
const factory = new VexFlow.Factory({
renderer: { elementId: 'output', width: 250, height: 150 },
});
context = factory.context;
const score = factory.EasyScore();
notes = score.notes('C4/q, F#4, B5, Bb4');
let voice = score.voice(notes);
const system = factory.System();
system.addStave({voices: [voice]}).addClef('treble').addTimeSignature('4/4');
let invisible = "#00000000";
for (let note of notes){
note.setStyle({ fillStyle: invisible, strokeStyle: invisible });
}
factory.draw();
for (let note of notes){
const svg = note.getSVGElement();
if (svg) {
svg.classList.add('fade-in');
}
}
});