1.2.13 • Published 11 months ago

vue-piano-roll v1.2.13

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

PianoRoll Vue Component

A flexible, highly customizable Piano Roll component for Vue.js. This component allows you to create a piano roll in your Vue application with ease.

Demo

Demo available here and demo source code, here.

Installation

yarn add vue-piano-roll

Usage

Import the component in your Vue application:

import { PianoRoll } from "vue-piano-roll";
import "vue-piano-roll/dist/style.css";

const notes = ref([]);

or

import { PianoRoll, PianoRollNote } from "vue-piano-roll";
import "vue-piano-roll/dist/style.css";

const notes = ref([] as PianoRollNote[]);

Then use the PianoRoll component in your template:

<piano-roll v-model="notes"></piano-roll>

The PianoRoll component requires a v-model binding to an array to function correctly and also supports a variety of optional props:

<piano-roll
  v-model="notes"
  :zoomX="0.5"
  :zoomY="1"
  :currentBeat="0"
  :currentTick="0"
  :ticksPerBeat="4"
  :rangeBottom="'C1'"
  :rangeTop="'G5'"
  :length="80"
  :defaultNoteLength="2"
  :noteHeight="1"
  :noteColor="'#f43f5f'"
  :loop="true"
  :onNoteEvent="handleNoteEvent"
></piano-roll>

Props

PropTypeDefault ValueDescription
zoomXNumber0.5Defines the zoom level along the x-axis.
zoomYNumber1Defines the zoom level along the y-axis.
rangeBottomOctaveNote"C1"The lowest note that the piano roll should display.
rangeTopOctaveNote"G5"The highest note that the piano roll should display.
currentBeatNumber-1The current beat.
currentTickNumber--The current tick within the beat.
ticksPerBeatNumber2The number of ticks in a beat.
defaultNoteLengthNumber1The default number of beats in a note.
noteHeightNumber2The apparent 3D height of the piano roll notes.
modelValueArray--The array of notes for the piano roll.
lengthNumber|"infinite"80The total length of the piano roll. (also supports the string "infinite")
loopBooleantrueIf true, the piano roll will loop back to the beginning when it reaches the end.
noteColorString"#f43f5f"The default color of the piano roll notes.
backgroundColorString"rgb(76, 85, 99)"The background color of the piano roll.
incidentalColorString"rgb(55, 65, 81)"The color of the incidentals (sharps and flats) in the piano roll.
gridColorString"rgb(107, 114, 128)"The color of the grid lines in the piano roll.
labelColorString"rgb(255, 255, 255)"The color of the note labels in the piano roll.
labelIncidentalColorString"rgb(107, 114, 128)"The color of the incidental note labels in the piano roll.
labelBackgroundColorString"rgb(107, 114, 128)"The background color of the note labels in the piano roll.
labelBorderColorString"rgb(75, 85, 99)"The border color of the note labels in the piano roll.
borderWidthNumber1The width of the border around the piano roll.
shadowColorString"rgba(255, 255, 255, 0.3)"The color of the shadow cast by the notes in the piano roll.
shadowMapArray[]An array of ShadowMap objects, each defining how shadows appear for a specific note in the piano roll.
onNoteEventFunction--A callback function with a NoteEvent argument that includes a list of notes that have started/ended.

Events

The PianoRoll emits the following events:

EventOutput TypeDescription
update:modelValueArrayEmits the updated array of notes when notes are modified.

Contributing

Contributions are welcome! If you have any issues or

feature requests, please submit an issue on Github.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

1.2.0

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.2.8

11 months ago

1.2.7

11 months ago

1.2.6

11 months ago

1.2.5

11 months ago

1.1.4

12 months ago

1.1.3

12 months ago

1.1.2

12 months ago

1.2.9

11 months ago

1.2.12

11 months ago

1.2.13

11 months ago

1.2.10

11 months ago

1.2.11

11 months ago

1.0.11

12 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago