admin管理员组

文章数量:1325720

How to display a dotted note with vexflow. For example dans le code suivant : new Vex.Flow.StaveNote({keys: ["c/4"], duration: "qd" } the "d" is taken into account in the duration of the note but is not displayed in the scope

Version vexFlow : 4.2.2 src="/[email protected]/build/cjs/vexflow.js">

How to display a dotted note with vexflow. For example dans le code suivant : new Vex.Flow.StaveNote({keys: ["c/4"], duration: "qd" } the "d" is taken into account in the duration of the note but is not displayed in the scope

Version vexFlow : 4.2.2 src="https://cdn.jsdelivr/npm/[email protected]/build/cjs/vexflow.js">

Share Improve this question edited Jan 23 at 7:43 DarkBee 15.6k8 gold badges72 silver badges117 bronze badges asked Dec 17, 2024 at 12:47 Guy44Guy44 154 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

It's a bit strange, but you have to first set in the constructor to make internal changes in StaveNote:

const note = new Vex.Flow.StaveNote({keys: ["c/4"], duration: "q", dots: 1 }

And after you have to add a modifier to display the dot, like this:

const indexOfKey = 0;
note.addModifier(new Dot(), indexOfKey)

Or like this:

Dot.buildAndAttach([note], {all: true});

{all: true} in this case means that the dots will be displayed in all the keys if your StaveNote has multiple keys

本文标签: javascriptHow to display a dotted musical noteStack Overflow