new PixelMap(mapper, offset)
A PixelMap maps one offset to one x location.
The offset does NOT have to be the offset of an element. Offsets are generally
measured from the start of the flat stream.
Parameters:
| Name | Type | Description |
|---|---|---|
mapper |
music21.streamInteraction.PixelMapper | should eventually be a weakref... |
offset |
number | the offset that is being mapped. |
- elements being mapped to.
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
elements |
Array.<music21.base.Music21Object> | |
offset |
number | the offset inputted |
x |
number | x value in pixels for this offset |
systemIndex |
Int | the systemIndex at which this offset appears. |
Example
// not a particularly realistic example, since it requires so much setup...
var s = new music21.tinyNotation.TinyNotation('3/4 c4 d8 e f4 g4 a4 b4');
var can = s.appendNewCanvas();
var pmapper = new music21.streamInteraction.PixelMapper(s);
var pmapA = new music21.streamInteraction.PixelMap(pmapper, 2.0);
pmapA.elements = [s.flat.get(3)];
pmapA.offset;
// 2
pmapA.x;
// 149.32...
pmapA.systemIndex
// 0