From e5b86f8cbc9277d8681dc5f189800803f14f1a17 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Mon, 27 Jul 2020 06:57:37 -0400 Subject: [PATCH] 7/8 --- app.js | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/app.js b/app.js index 2c4a093..07553f7 100644 --- a/app.js +++ b/app.js @@ -5,37 +5,32 @@ var div = document.querySelector("body") var renderer = new VF.Renderer(div, VF.Renderer.Backends.SVG); // Size our SVG: -renderer.resize(500, 500); +renderer.resize(1000, 1000); // And get a drawing context: var context = renderer.getContext(); // Create a stave at position 10, 40 of width 400 on the canvas. -var stave = new VF.Stave(10, 40, 400); +var stave = new VF.Stave(10, 40, 800); // Add a clef and time signature. -stave.addClef("treble").addTimeSignature("4/4"); +stave.addClef("treble").addTimeSignature("7/8"); // Connect it to the rendering context and draw! stave.setContext(context).draw(); var notes = [ - // A quarter-note C. - new VF.StaveNote({clef: "treble", keys: ["c/4"], duration: "q" }), - - // A quarter-note D. - new VF.StaveNote({clef: "treble", keys: ["d/4"], duration: "q" }), - - // A quarter-note rest. Note that the key (b/4) specifies the vertical - // position of the rest. - new VF.StaveNote({clef: "treble", keys: ["b/4"], duration: "qr" }), - - // A C-Major chord. - new VF.StaveNote({clef: "treble", keys: ["c/4", "e/4", "g/4"], duration: "q" }) + new VF.StaveNote({clef: "treble", keys: ["c/4"], duration: "8" }), + new VF.StaveNote({clef: "treble", keys: ["d/4"], duration: "8" }), + new VF.StaveNote({clef: "treble", keys: ["b/4"], duration: "8" }), + new VF.StaveNote({clef: "treble", keys: ["d/4"], duration: "8" }), + new VF.StaveNote({clef: "treble", keys: ["d/4"], duration: "8" }), + new VF.StaveNote({clef: "treble", keys: ["d/4"], duration: "8" }), + new VF.StaveNote({clef: "treble", keys: ["d/4"], duration: "8" }), ]; // Create a voice in 4/4 and add the notes from above -var voice = new VF.Voice({num_beats: 4, beat_value: 4}); +var voice = new VF.Voice({num_beats: 7, beat_value: 8}); voice.addTickables(notes); // Format and justify the notes to 400 pixels.