jpfun 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -11
- package/dist/diagnostic.js +5 -2
- package/dist/fraction.d.ts +24 -0
- package/dist/fraction.js +132 -0
- package/dist/functions/ASTtypes.d.ts +24 -7
- package/dist/functions/ASTtypes.js +35 -16
- package/dist/functions/adjust/index.d.ts +2 -0
- package/dist/functions/adjust/index.js +193 -0
- package/dist/functions/bar/index.d.ts +8 -0
- package/dist/functions/bar/index.js +39 -10
- package/dist/functions/beam/auto.js +32 -15
- package/dist/functions/beam/index.js +10 -6
- package/dist/functions/beam/layout.d.ts +3 -2
- package/dist/functions/beam/layout.js +42 -64
- package/dist/functions/box/index.js +35 -34
- package/dist/functions/br/index.js +9 -7
- package/dist/functions/dash/index.js +33 -1
- package/dist/functions/default.js +14 -7
- package/dist/functions/div/index.d.ts +16 -0
- package/dist/functions/div/index.js +45 -17
- package/dist/functions/dot/index.js +11 -3
- package/dist/functions/grace/index.d.ts +8 -11
- package/dist/functions/grace/index.js +82 -76
- package/dist/functions/head/index.d.ts +2 -0
- package/dist/functions/head/index.js +492 -0
- package/dist/functions/key/index.js +97 -3
- package/dist/functions/meter/index.d.ts +2 -0
- package/dist/functions/meter/index.js +154 -0
- package/dist/functions/note/accidentals.d.ts +24 -3
- package/dist/functions/note/accidentals.js +31 -1
- package/dist/functions/note/index.js +45 -65
- package/dist/functions/page/index.d.ts +9 -2
- package/dist/functions/page/index.js +50 -4
- package/dist/functions/set/index.js +37 -29
- package/dist/functions/stack/index.js +26 -22
- package/dist/functions/symbol/index.d.ts +21 -0
- package/dist/functions/symbol/index.js +94 -0
- package/dist/functions/symbol/ornament.d.ts +15 -0
- package/dist/functions/symbol/ornament.js +73 -0
- package/dist/functions/symbol/shape.d.ts +22 -0
- package/dist/functions/symbol/shape.js +48 -0
- package/dist/functions/symbol/symbols/accent.d.ts +2 -0
- package/dist/functions/symbol/symbols/accent.js +24 -0
- package/dist/functions/symbol/symbols/f.d.ts +2 -0
- package/dist/functions/symbol/symbols/f.js +55 -0
- package/dist/functions/symbol/symbols/fermata.d.ts +2 -0
- package/dist/functions/symbol/symbols/fermata.js +24 -0
- package/dist/functions/symbol/symbols/mordent.d.ts +2 -0
- package/dist/functions/symbol/symbols/mordent.js +43 -0
- package/dist/functions/symbol/symbols/p.d.ts +2 -0
- package/dist/functions/symbol/symbols/p.js +61 -0
- package/dist/functions/symbol/symbols/tr.d.ts +2 -0
- package/dist/functions/symbol/symbols/tr.js +75 -0
- package/dist/functions/tempo/glyph.d.ts +12 -0
- package/dist/functions/tempo/glyph.js +30 -0
- package/dist/functions/tempo/index.js +53 -2
- package/dist/functions/text/index.js +76 -24
- package/dist/functions/tie/index.js +102 -127
- package/dist/functions/tuplet/index.d.ts +2 -0
- package/dist/functions/tuplet/index.js +211 -0
- package/dist/functions/up/index.d.ts +1 -0
- package/dist/functions/up/index.js +245 -171
- package/dist/functions/voice/index.js +86 -68
- package/dist/functions/volta/index.d.ts +2 -0
- package/dist/functions/volta/index.js +227 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/jpfun.min.js +143 -0
- package/dist/layout/engine.d.ts +4 -11
- package/dist/layout/engine.js +65 -59
- package/dist/layout/model.d.ts +8 -1
- package/dist/layout/model.js +16 -6
- package/dist/layout/path.d.ts +19 -0
- package/dist/layout/path.js +101 -0
- package/dist/layout/types.d.ts +51 -18
- package/dist/layout/types.js +3 -1
- package/dist/lowering/loweringContext.d.ts +18 -20
- package/dist/lowering/loweringContext.js +132 -94
- package/dist/lowering/track.d.ts +1 -1
- package/dist/lowering/track.js +1 -1
- package/dist/lowering/types.d.ts +49 -12
- package/dist/lowering/types.js +9 -3
- package/dist/parser/parse-utils/call-utils.d.ts +0 -2
- package/dist/parser/parse-utils/call-utils.js +0 -6
- package/dist/parser/parse-utils/note-utils.d.ts +8 -0
- package/dist/parser/parse-utils/note-utils.js +35 -13
- package/dist/parser/parse-utils/string-utils.d.ts +8 -0
- package/dist/parser/parse-utils/string-utils.js +20 -0
- package/dist/parser/parserContext.d.ts +8 -5
- package/dist/parser/parserContext.js +38 -33
- package/dist/parser/preprocess.js +17 -11
- package/dist/playback/compile.d.ts +18 -0
- package/dist/playback/compile.js +401 -0
- package/dist/playback/event.d.ts +91 -0
- package/dist/playback/event.js +87 -0
- package/dist/playback/time.d.ts +14 -0
- package/dist/playback/time.js +81 -0
- package/dist/playback/types.d.ts +128 -0
- package/dist/playback/types.js +3 -0
- package/dist/render/canvas.d.ts +4 -4
- package/dist/render/canvas.js +20 -5
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.js +1 -0
- package/dist/render/paint.d.ts +8 -0
- package/dist/render/paint.js +101 -0
- package/dist/render/svg.d.ts +3 -3
- package/dist/render/svg.js +10 -8
- package/dist/render/text.d.ts +17 -0
- package/dist/render/text.js +35 -0
- package/dist/render/types.d.ts +1 -1
- package/grammar.md +93 -10
- package/package.json +10 -6
|
@@ -71,31 +71,34 @@ class StackFunction extends ASTFunctionNode {
|
|
|
71
71
|
continue;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
|
-
let
|
|
75
|
-
if (
|
|
74
|
+
let leftNode = left >= 0 ? ctx.nodes[left] : null;
|
|
75
|
+
if (leftNode === null) {
|
|
76
76
|
throw new ErrorDiagnostic("E_STACK_NO_TARGET", "@stack语法糖错误: 左边没有找到可叠加的目标", n.span);
|
|
77
77
|
}
|
|
78
78
|
/** 左操作数在 ctx.nodes 中的起点;只有这一段会被 stack 吞并,更早的节点必须保留 */
|
|
79
79
|
let replaceFrom = left;
|
|
80
80
|
// 对 label 的特判: 目标变为label到被标记的节点范围内的所有节点
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
81
|
+
if (leftNode instanceof ASTLabelNode) {
|
|
82
|
+
const labelNode = leftNode;
|
|
83
|
+
let tgt = labelNode.target;
|
|
84
|
+
// 在本层这个节点位于哪里(标签节点可能被wrap)
|
|
85
|
+
while (tgt && !ctx.nodes.includes(tgt))
|
|
86
|
+
tgt = tgt.parent;
|
|
83
87
|
for (let j = left - 1; j >= 0; j--) {
|
|
84
88
|
if (ctx.nodes[j] === tgt) {
|
|
85
|
-
|
|
89
|
+
leftNode = new ASTBraceNode({
|
|
86
90
|
start: tgt.sourceSpan.start,
|
|
87
|
-
end:
|
|
91
|
+
end: labelNode.sourceSpan.end,
|
|
88
92
|
}, ctx.nodes.slice(j, left + 1), null);
|
|
89
93
|
replaceFrom = j;
|
|
90
94
|
break;
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
98
|
+
// 左操作数收敛成一个 stack,后续合并都在它身上进行
|
|
99
|
+
const host = leftNode instanceof StackFunction
|
|
100
|
+
? leftNode
|
|
101
|
+
: new StackFunction(n.span, new Map(), ctx).addContent(leftNode);
|
|
99
102
|
// 找到下一个非文本节点 通过全量后续解析的方式进行 还是有些trick
|
|
100
103
|
const storage = ctx.nodes;
|
|
101
104
|
ctx.nodes = [];
|
|
@@ -105,9 +108,9 @@ class StackFunction extends ASTFunctionNode {
|
|
|
105
108
|
const right = ctx.nodes[i];
|
|
106
109
|
if (right instanceof ASTTextNode)
|
|
107
110
|
continue;
|
|
108
|
-
|
|
111
|
+
host.addContent(right);
|
|
109
112
|
storage.length = replaceFrom;
|
|
110
|
-
storage.push(
|
|
113
|
+
storage.push(host);
|
|
111
114
|
while (++i < ctx.nodes.length)
|
|
112
115
|
storage.push(ctx.nodes[i]);
|
|
113
116
|
ctx.nodes = storage;
|
|
@@ -131,27 +134,28 @@ class StackFunction extends ASTFunctionNode {
|
|
|
131
134
|
this.addContent(value);
|
|
132
135
|
continue;
|
|
133
136
|
}
|
|
134
|
-
const c = ctx.parseArgWithType(value.
|
|
137
|
+
const c = ctx.parseArgWithType(value.valueSpan, "content", span.start);
|
|
135
138
|
if (c !== null) {
|
|
136
139
|
this.addContent(c);
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
142
|
}
|
|
143
|
+
/** 遇到另一个 stack 就展平;返回存活的那个,调用者必须改用返回值 */
|
|
140
144
|
addContent(node) {
|
|
141
145
|
if (node instanceof StackFunction)
|
|
142
|
-
this.combine(node);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
146
|
+
return this.combine(node);
|
|
147
|
+
this.contents.push(node);
|
|
148
|
+
node.parent = this;
|
|
149
|
+
const s = node.sourceSpan;
|
|
150
|
+
this.sourceSpan.start = Math.min(this.sourceSpan.start, s.start);
|
|
151
|
+
this.sourceSpan.end = Math.max(this.sourceSpan.end, s.end);
|
|
152
|
+
return this;
|
|
150
153
|
}
|
|
151
154
|
toString(source) {
|
|
152
155
|
const contentStrs = this.contents.map(c => c.toString(source)).join(',\n');
|
|
153
156
|
return `@stack(\n ${contentStrs.split('\n').join('\n ')}\n)`;
|
|
154
157
|
}
|
|
158
|
+
// stack 不实现 labelable、不进候选表,所以被吞并的空壳不会被 @tie() 取到,无需像 up 那样撤销登记
|
|
155
159
|
combine(ano) {
|
|
156
160
|
this.sourceSpan.start = Math.min(this.sourceSpan.start, ano.sourceSpan.start);
|
|
157
161
|
this.sourceSpan.end = Math.max(this.sourceSpan.end, ano.sourceSpan.end);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type TimeState } from "../../lowering/types.js";
|
|
2
|
+
import type { PlaybackEmitter } from "../../playback/types.js";
|
|
3
|
+
import { type ASTFunctionClass } from "../ASTtypes.js";
|
|
4
|
+
import { type SymbolShape } from "./shape.js";
|
|
5
|
+
/**
|
|
6
|
+
* 一个乐谱符号:固定图形加可选的播放语义
|
|
7
|
+
*
|
|
8
|
+
* 每个符号自成一个文件、彼此没有依赖,新增一个符号就是新增一个对象字面量
|
|
9
|
+
*/
|
|
10
|
+
export interface SymbolDefinition {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly shapes: readonly SymbolShape[];
|
|
14
|
+
/** 符号高度 = size × weight,用来修正宽扁字形的视觉重量;默认 1 */
|
|
15
|
+
readonly weight?: number;
|
|
16
|
+
/** 写入本位置之后持续生效的状态,例如力度记号的 velocity */
|
|
17
|
+
readonly onTimeState?: (state: TimeState) => void;
|
|
18
|
+
/** 发布系统控制,或注册对同一折叠序列后续音符的局部变换 */
|
|
19
|
+
readonly emitPlayback?: (emitter: PlaybackEmitter) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const SymbolNode: ASTFunctionClass;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ErrorDiagnostic } from "../../diagnostic.js";
|
|
2
|
+
import { DEFAULT_KEY, TemporalNodeBase } from "../../lowering/types.js";
|
|
3
|
+
import { ASTFunctionNode, } from "../ASTtypes.js";
|
|
4
|
+
import { paintSymbol, symbolBounds } from "./shape.js";
|
|
5
|
+
import { accentSymbol } from "./symbols/accent.js";
|
|
6
|
+
import { fermataSymbol } from "./symbols/fermata.js";
|
|
7
|
+
import { fSymbol } from "./symbols/f.js";
|
|
8
|
+
import { mordentSymbol } from "./symbols/mordent.js";
|
|
9
|
+
import { pSymbol } from "./symbols/p.js";
|
|
10
|
+
import { trSymbol } from "./symbols/tr.js";
|
|
11
|
+
const symbolTable = new Map([trSymbol, fSymbol, pSymbol, fermataSymbol, mordentSymbol, accentSymbol]
|
|
12
|
+
.map(definition => [definition.name.toLowerCase(), definition]));
|
|
13
|
+
class SymbolFunction extends ASTFunctionNode {
|
|
14
|
+
static def = {
|
|
15
|
+
name: ["symbol", "$"],
|
|
16
|
+
description: "创建一个乐谱符号",
|
|
17
|
+
example: [
|
|
18
|
+
"@symbol(name, size)",
|
|
19
|
+
"语法糖: $name",
|
|
20
|
+
"内置:",
|
|
21
|
+
...[...symbolTable.values()].map(item => ` $${item.name} ${item.description}`),
|
|
22
|
+
].join("\n"),
|
|
23
|
+
allowExtraArgs: false,
|
|
24
|
+
args: [
|
|
25
|
+
{
|
|
26
|
+
name: "name",
|
|
27
|
+
type: "string",
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "size",
|
|
32
|
+
type: "length",
|
|
33
|
+
default: { value: 0.5, unit: "em" },
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
static deSugarAtom(source, start, end) {
|
|
38
|
+
if (source[start] !== "$" || !/[A-Za-z]/.test(source[start + 1] ?? ""))
|
|
39
|
+
return null;
|
|
40
|
+
let next = start + 2;
|
|
41
|
+
while (next < end && /[A-Za-z0-9_-]/.test(source[next]))
|
|
42
|
+
next++;
|
|
43
|
+
const name = source.slice(start + 1, next);
|
|
44
|
+
const node = {
|
|
45
|
+
kind: "call",
|
|
46
|
+
typed: true,
|
|
47
|
+
name: "symbol",
|
|
48
|
+
args: new Map([[0, name]]),
|
|
49
|
+
span: { start, end: next },
|
|
50
|
+
syntaxKind: "atom",
|
|
51
|
+
};
|
|
52
|
+
return { next, node };
|
|
53
|
+
}
|
|
54
|
+
size;
|
|
55
|
+
definition;
|
|
56
|
+
constructor(sourceSpan, args, ctx, parent = null) {
|
|
57
|
+
super(sourceSpan, parent);
|
|
58
|
+
const [name, size] = this.getArgValue(args, ctx);
|
|
59
|
+
this.size = ctx.length2px(size);
|
|
60
|
+
const definition = symbolTable.get(name.toLowerCase());
|
|
61
|
+
if (!definition) {
|
|
62
|
+
throw new ErrorDiagnostic("E_UNKNOWN_SYMBOL", `@symbol: 未知符号: $${name}`, sourceSpan);
|
|
63
|
+
}
|
|
64
|
+
this.definition = definition;
|
|
65
|
+
}
|
|
66
|
+
loweringEnter() { return [new SymbolTemporal(this)]; }
|
|
67
|
+
toString() { return `@symbol(${this.definition.name})`; }
|
|
68
|
+
}
|
|
69
|
+
export const SymbolNode = SymbolFunction;
|
|
70
|
+
class SymbolTemporal extends TemporalNodeBase {
|
|
71
|
+
/** 符号自身坐标系里的固有包围盒,与布局轮次无关 */
|
|
72
|
+
bounds;
|
|
73
|
+
scale = 1;
|
|
74
|
+
constructor(ast) {
|
|
75
|
+
super();
|
|
76
|
+
this.ast = ast;
|
|
77
|
+
this.mergeKey = DEFAULT_KEY;
|
|
78
|
+
this.onTimeState = ast.definition.onTimeState;
|
|
79
|
+
this.emitPlayback = ast.definition.emitPlayback;
|
|
80
|
+
this.bounds = symbolBounds(ast.definition.shapes);
|
|
81
|
+
this.initLayoutBox();
|
|
82
|
+
}
|
|
83
|
+
prepareLayout() {
|
|
84
|
+
const height = this.ast.size * (this.ast.definition.weight ?? 1);
|
|
85
|
+
this.scale = height / this.bounds.h;
|
|
86
|
+
this.box.w = this.bounds.w * this.scale;
|
|
87
|
+
this.box.h = height;
|
|
88
|
+
this.box.anchor = this.box.w / 2;
|
|
89
|
+
this.box.visualAxis = height / 2;
|
|
90
|
+
}
|
|
91
|
+
paint(painter) {
|
|
92
|
+
paintSymbol(painter, this.ast.definition.shapes, this.bounds, this.box, this.scale);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PlaybackTransform } from "../../playback/types.js";
|
|
2
|
+
interface OrnamentPattern {
|
|
3
|
+
/** 调内音级偏移序列,0 表示本音 */
|
|
4
|
+
readonly body: readonly number[];
|
|
5
|
+
/** 主体是否重复到填满宿主时值 */
|
|
6
|
+
readonly repeat?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 把一个音按固定音级模式展开成装饰音序列
|
|
10
|
+
*
|
|
11
|
+
* 密度按发声时的速度决定而不是固定的记谱时值:固定 1/8 四分音符在慢速下
|
|
12
|
+
* 每秒只有两三次,听起来根本不是颤音。默认速度下仍然恰好是 1/8 四分音符。
|
|
13
|
+
*/
|
|
14
|
+
export declare function ornament(pattern: OrnamentPattern): PlaybackTransform;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** 每个四分音符的名义子音数 */
|
|
2
|
+
const NOMINAL_RATE = 8;
|
|
3
|
+
/** 密度只在极端速度下偏离名义值:区间内 bpm 会在算式里精确抵消 */
|
|
4
|
+
const MIN_BPM = 60;
|
|
5
|
+
const MAX_BPM = 480;
|
|
6
|
+
/** 一个装饰音能展开的子音上限;防的是 `@tempo(0.01)` 这类手滑 */
|
|
7
|
+
const MAX_SUBNOTES = 256;
|
|
8
|
+
/**
|
|
9
|
+
* 把一个音按固定音级模式展开成装饰音序列
|
|
10
|
+
*
|
|
11
|
+
* 密度按发声时的速度决定而不是固定的记谱时值:固定 1/8 四分音符在慢速下
|
|
12
|
+
* 每秒只有两三次,听起来根本不是颤音。默认速度下仍然恰好是 1/8 四分音符。
|
|
13
|
+
*/
|
|
14
|
+
export function ornament(pattern) {
|
|
15
|
+
return (context, owned) => {
|
|
16
|
+
const noteOffs = new Map();
|
|
17
|
+
for (const event of owned) {
|
|
18
|
+
if (event.kind === "note-off")
|
|
19
|
+
noteOffs.set(event.noteId, event);
|
|
20
|
+
}
|
|
21
|
+
const removed = new Set();
|
|
22
|
+
const added = [];
|
|
23
|
+
for (const note of owned) {
|
|
24
|
+
if (note.kind !== "note-on" || !note.transpose)
|
|
25
|
+
continue;
|
|
26
|
+
const off = noteOffs.get(note.noteId);
|
|
27
|
+
if (!off)
|
|
28
|
+
continue;
|
|
29
|
+
const duration = off.at.clone().sub(note.at);
|
|
30
|
+
const bpm = context.stateAt(note.at).effectiveBpm;
|
|
31
|
+
const steps = pattern.repeat ? repeatToFill(pattern.body, duration.toNumber(), bpm) : pattern.body;
|
|
32
|
+
const step = duration.div(steps.length);
|
|
33
|
+
removed.add(note);
|
|
34
|
+
removed.add(off);
|
|
35
|
+
for (let index = 0; index < steps.length; index++) {
|
|
36
|
+
const offset = steps[index];
|
|
37
|
+
const noteId = context.nextNoteId();
|
|
38
|
+
const at = note.at.clone().add(step.clone().mul(index));
|
|
39
|
+
const order = note.order + index / steps.length;
|
|
40
|
+
const on = {
|
|
41
|
+
...note,
|
|
42
|
+
at,
|
|
43
|
+
noteId,
|
|
44
|
+
order,
|
|
45
|
+
// 本音保留主体的临时升降号,只有偏移音才走调内换算
|
|
46
|
+
midi: offset === 0 ? note.midi : note.transpose(offset),
|
|
47
|
+
// 后续 ornament 要从这个派生音继续移调,不能仍以最初的宿主为基准
|
|
48
|
+
transpose: delta => note.transpose(offset + delta),
|
|
49
|
+
origins: [...note.origins],
|
|
50
|
+
sourceSpans: note.sourceSpans.map(span => ({ ...span })),
|
|
51
|
+
};
|
|
52
|
+
added.push(on, {
|
|
53
|
+
...off,
|
|
54
|
+
at: at.clone().add(step),
|
|
55
|
+
noteId,
|
|
56
|
+
order,
|
|
57
|
+
origins: [...off.origins],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return [...owned.filter(event => !removed.has(event)), ...added];
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function repeatToFill(body, duration, bpm) {
|
|
65
|
+
// 名义密度与速度无关(秒数里的 bpm 与频率里的 bpm 恰好抵消),只在 bpm 越界时按比例修正
|
|
66
|
+
const ratio = Math.min(MAX_BPM, Math.max(MIN_BPM, bpm)) / bpm;
|
|
67
|
+
const limit = Math.floor(MAX_SUBNOTES / body.length);
|
|
68
|
+
const cycles = Math.min(limit, Math.max(1, Math.round(duration * NOMINAL_RATE * ratio / body.length)));
|
|
69
|
+
const result = [];
|
|
70
|
+
for (let i = 0; i < cycles; i++)
|
|
71
|
+
result.push(...body);
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 符号自身坐标系与布局坐标系之间的换算
|
|
3
|
+
*
|
|
4
|
+
* `symbolBounds` 量出图元在符号自身坐标系里的固有包围盒,布局据此定 box;
|
|
5
|
+
* `paintSymbol` 反过来把同一批图元放到最终 box 上。两者必须读同一份 bounds,
|
|
6
|
+
* 否则墨迹会偏出框——符号原点不一定落在墨迹左上角。
|
|
7
|
+
*/
|
|
8
|
+
import type { LayoutBox, Rect } from "../../layout/types.js";
|
|
9
|
+
import type { PaintStyle, Painter, PathCommand } from "../../render/types.js";
|
|
10
|
+
/** 符号的一个图元;坐标在符号自身坐标系里,缩放由布局决定 */
|
|
11
|
+
export interface SymbolShape {
|
|
12
|
+
readonly path?: readonly PathCommand[];
|
|
13
|
+
readonly circle?: {
|
|
14
|
+
readonly cx: number;
|
|
15
|
+
readonly cy: number;
|
|
16
|
+
readonly r: number;
|
|
17
|
+
};
|
|
18
|
+
readonly style: PaintStyle;
|
|
19
|
+
}
|
|
20
|
+
/** 全体图元的并集;宽高钳到正数,否则纯横线或纯竖线的符号会让缩放比例除零 */
|
|
21
|
+
export declare function symbolBounds(shapes: readonly SymbolShape[]): Rect;
|
|
22
|
+
export declare function paintSymbol(painter: Painter, shapes: readonly SymbolShape[], bounds: Rect, box: Readonly<LayoutBox>, scale: number): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 符号自身坐标系与布局坐标系之间的换算
|
|
3
|
+
*
|
|
4
|
+
* `symbolBounds` 量出图元在符号自身坐标系里的固有包围盒,布局据此定 box;
|
|
5
|
+
* `paintSymbol` 反过来把同一批图元放到最终 box 上。两者必须读同一份 bounds,
|
|
6
|
+
* 否则墨迹会偏出框——符号原点不一定落在墨迹左上角。
|
|
7
|
+
*/
|
|
8
|
+
import { pathBounds } from "../../layout/path.js";
|
|
9
|
+
/** 全体图元的并集;宽高钳到正数,否则纯横线或纯竖线的符号会让缩放比例除零 */
|
|
10
|
+
export function symbolBounds(shapes) {
|
|
11
|
+
let left = Infinity;
|
|
12
|
+
let top = Infinity;
|
|
13
|
+
let right = -Infinity;
|
|
14
|
+
let bottom = -Infinity;
|
|
15
|
+
const merge = (rect) => {
|
|
16
|
+
left = Math.min(left, rect.x);
|
|
17
|
+
top = Math.min(top, rect.y);
|
|
18
|
+
right = Math.max(right, rect.x + rect.w);
|
|
19
|
+
bottom = Math.max(bottom, rect.y + rect.h);
|
|
20
|
+
};
|
|
21
|
+
for (const shape of shapes) {
|
|
22
|
+
if (shape.circle) {
|
|
23
|
+
const { cx, cy, r } = shape.circle;
|
|
24
|
+
merge({ x: cx - r, y: cy - r, w: 2 * r, h: 2 * r });
|
|
25
|
+
}
|
|
26
|
+
if (shape.path?.length)
|
|
27
|
+
merge(pathBounds(shape.path));
|
|
28
|
+
}
|
|
29
|
+
return Number.isFinite(left)
|
|
30
|
+
? { x: left, y: top, w: Math.max(1e-9, right - left), h: Math.max(1e-9, bottom - top) }
|
|
31
|
+
: { x: 0, y: 0, w: 1e-9, h: 1e-9 };
|
|
32
|
+
}
|
|
33
|
+
export function paintSymbol(painter, shapes, bounds, box, scale) {
|
|
34
|
+
const originX = box.x - bounds.x * scale;
|
|
35
|
+
const originY = box.y - bounds.y * scale;
|
|
36
|
+
for (const shape of shapes) {
|
|
37
|
+
const style = shape.style;
|
|
38
|
+
const scaled = style.strokeWidth === undefined
|
|
39
|
+
? style
|
|
40
|
+
: { ...style, strokeWidth: style.strokeWidth * scale };
|
|
41
|
+
if (shape.path) {
|
|
42
|
+
painter.drawPath(shape.path, scaled, { x: originX, y: originY, scaleX: scale, scaleY: scale });
|
|
43
|
+
}
|
|
44
|
+
if (shape.circle) {
|
|
45
|
+
painter.drawCircle(originX + shape.circle.cx * scale, originY + shape.circle.cy * scale, shape.circle.r * scale, scaled);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const ACCENT_BOOST = 20;
|
|
2
|
+
const MAX_VELOCITY = 127;
|
|
3
|
+
export const accentSymbol = {
|
|
4
|
+
name: "accent",
|
|
5
|
+
description: "重音",
|
|
6
|
+
weight: 0.5,
|
|
7
|
+
shapes: [
|
|
8
|
+
{
|
|
9
|
+
path: [
|
|
10
|
+
{ op: "M", x: 0.21413, y: 0.4818 },
|
|
11
|
+
{ op: "L", x: 8.21413, y: 3.72071 },
|
|
12
|
+
{ op: "L", x: 0.29494, y: 6.92724 },
|
|
13
|
+
],
|
|
14
|
+
style: { stroke: "#000", strokeWidth: 1 },
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
emitPlayback: emitter => emitter.affectFollowing((_context, events) => {
|
|
18
|
+
for (const event of events) {
|
|
19
|
+
if (event.kind === "note-on") {
|
|
20
|
+
event.velocity = Math.min(MAX_VELOCITY, event.velocity + ACCENT_BOOST);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const FORTE_VELOCITY = 96;
|
|
2
|
+
export const fSymbol = {
|
|
3
|
+
name: "f",
|
|
4
|
+
description: "强",
|
|
5
|
+
shapes: [
|
|
6
|
+
{
|
|
7
|
+
path: [
|
|
8
|
+
{ op: "M", x: 6.805, y: 3.24553 },
|
|
9
|
+
{ op: "L", x: 8.5437, y: 3.24553 },
|
|
10
|
+
{ op: "L", x: 8.5437, y: 3.89757 },
|
|
11
|
+
{ op: "L", x: 6.60698, y: 3.89757 },
|
|
12
|
+
{ op: "C", cx1: 6.05169, cy1: 5.7957, cx2: 5.56385, cy2: 7.20105, x: 5.14365, y: 8.11383 },
|
|
13
|
+
{ op: "C", cx1: 4.83447, cy1: 8.76586, cx2: 4.53022, cy2: 9.3261, x: 4.23564, y: 9.79455 },
|
|
14
|
+
{ op: "C", cx1: 3.94108, cy1: 10.26319, cx2: 3.57392, cy2: 10.664, x: 3.13455, y: 10.99733 },
|
|
15
|
+
{ op: "C", cx1: 2.69497, cy1: 11.33542, cx2: 2.17827, cy2: 11.53344, x: 1.58419, y: 11.59615 },
|
|
16
|
+
{ op: "C", cx1: 1.18814, cy1: 11.59615, cx2: 0.82592, cy2: 11.46084, x: 0.49258, y: 11.19535 },
|
|
17
|
+
{ op: "C", cx1: 0.16419, cy1: 10.92968, cx2: 0, cy2: 10.59161, x: 0, y: 10.17141 },
|
|
18
|
+
{ op: "C", cx1: 0, cy1: 9.90098, cx2: 0.07735, cy2: 9.64006, x: 0.2366, y: 9.38407 },
|
|
19
|
+
{ op: "C", cx1: 0.39605, cy1: 9.12808, cx2: 0.65204, cy2: 8.97831, x: 1.00951, y: 8.92531 },
|
|
20
|
+
{ op: "C", cx1: 1.24611, cy1: 8.92531, cx2: 1.44887, cy2: 9.00266, x: 1.62771, y: 9.15716 },
|
|
21
|
+
{ op: "C", cx1: 1.80634, cy1: 9.31643, cx2: 1.89813, cy2: 9.50494, x: 1.89813, y: 9.73186 },
|
|
22
|
+
{ op: "C", cx1: 1.89813, cy1: 9.88637, cx2: 1.85936, cy2: 10.01197, x: 1.78695, y: 10.10852 },
|
|
23
|
+
{ op: "C", cx1: 1.71455, cy1: 10.21001, cx2: 1.59387, cy2: 10.33066, x: 1.43443, y: 10.48043 },
|
|
24
|
+
{ op: "C", cx1: 1.27497, cy1: 10.63017, cx2: 1.16874, cy2: 10.76055, x: 1.12521, y: 10.86203 },
|
|
25
|
+
{ op: "C", cx1: 1.15905, cy1: 10.9924, cx2: 1.23639, cy2: 11.06006, x: 1.34757, y: 11.06006 },
|
|
26
|
+
{ op: "C", cx1: 1.74837, cy1: 11.06006, cx2: 2.10584, cy2: 10.81377, x: 2.4196, y: 10.32118 },
|
|
27
|
+
{ op: "C", cx1: 2.73355, cy1: 9.83335, cx2: 2.99447, cy2: 9.26339, x: 3.2022, y: 8.61136 },
|
|
28
|
+
{ op: "C", cx1: 3.40971, cy1: 7.95932, cx2: 3.64651, cy2: 7.10927, x: 3.92168, y: 6.06119 },
|
|
29
|
+
{ op: "C", cx1: 4.19706, cy1: 5.00836, cx2: 4.40952, cy2: 4.28867, x: 4.54959, y: 3.89757 },
|
|
30
|
+
{ op: "L", x: 3.24552, y: 3.89757 },
|
|
31
|
+
{ op: "L", x: 3.24552, y: 3.24553 },
|
|
32
|
+
{ op: "L", x: 4.82496, y: 3.24553 },
|
|
33
|
+
{ op: "C", cx1: 5.05187, cy1: 2.68054, cx2: 5.36582, cy2: 2.15393, x: 5.77156, y: 1.6566 },
|
|
34
|
+
{ op: "C", cx1: 6.18204, cy1: 1.15907, cx2: 6.65546, cy2: 0.76302, x: 7.19155, y: 0.45876 },
|
|
35
|
+
{ op: "C", cx1: 7.72766, cy1: 0.1545, cx2: 8.29265, cy2: 0, x: 8.88176, y: 0 },
|
|
36
|
+
{ op: "C", cx1: 9.36486, cy1: 0, cx2: 9.67384, cy2: 0.14975, x: 9.85268, y: 0.34777 },
|
|
37
|
+
{ op: "C", cx1: 10.03131, cy1: 0.5458, cx2: 10.14727, cy2: 0.83541, x: 10.20998, y: 0.97073 },
|
|
38
|
+
{ op: "C", cx1: 10.20998, cy1: 1.3282, cx2: 10.10374, cy2: 1.68548, x: 9.89602, y: 2.038 },
|
|
39
|
+
{ op: "C", cx1: 9.68851, cy1: 2.39072, cx2: 9.38899, cy2: 2.57905, x: 9.00264, y: 2.59349 },
|
|
40
|
+
{ op: "C", cx1: 8.9544, cy1: 2.54522, cx2: 8.86733, cy2: 2.49695, x: 8.74666, y: 2.44373 },
|
|
41
|
+
{ op: "C", cx1: 8.51006, cy1: 2.33275, cx2: 8.3892, cy2: 2.24571, x: 8.35061, y: 1.94145 },
|
|
42
|
+
{ op: "C", cx1: 8.39412, cy1: 1.49714, cx2: 8.59689, cy2: 1.19762, x: 8.95912, y: 1.04807 },
|
|
43
|
+
{ op: "C", cx1: 9.19573, cy1: 0.9901, cx2: 9.3166, cy2: 0.89831, x: 9.3166, y: 0.77269 },
|
|
44
|
+
{ op: "C", cx1: 9.3166, cy1: 0.5988, cx2: 9.17159, cy2: 0.49257, x: 8.88177, y: 0.45399 },
|
|
45
|
+
{ op: "C", cx1: 8.39416, cy1: 0.45399, cx2: 7.95931, cy2: 0.79208, x: 7.57793, y: 1.4633 },
|
|
46
|
+
{ op: "C", cx1: 7.32192, cy1: 1.84491, cx2: 7.06593, cy2: 2.43897, x: 6.805, y: 3.24551 },
|
|
47
|
+
{ op: "L", x: 6.805, y: 3.24551 },
|
|
48
|
+
{ op: "L", x: 6.805, y: 3.24553 },
|
|
49
|
+
{ op: "Z" },
|
|
50
|
+
],
|
|
51
|
+
style: { fill: "#000" },
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
onTimeState: state => { state.velocity = FORTE_VELOCITY; },
|
|
55
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const fermataSymbol = {
|
|
2
|
+
name: "fermata",
|
|
3
|
+
description: "延长记号:覆盖区间速度减半,目标音实际时长翻倍",
|
|
4
|
+
weight: 0.6,
|
|
5
|
+
shapes: [
|
|
6
|
+
{
|
|
7
|
+
path: [
|
|
8
|
+
{ op: "M", x: 0, y: 7.46666 },
|
|
9
|
+
{ op: "C", cx1: 3.65834, cy1: 0, cx2: 8.53611, cy2: 0, x: 12.19445, y: 7.46666 },
|
|
10
|
+
{ op: "M", x: 12.19445, y: 7.46666 },
|
|
11
|
+
{ op: "C", cx1: 8.53611, cy1: 0.74666, cx2: 3.65833, cy2: 0.74666, x: 0, y: 7.46666 },
|
|
12
|
+
],
|
|
13
|
+
style: { fill: "#000", stroke: "#000", strokeWidth: 1 },
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
circle: { cx: 6.09723, cy: 6.26666, r: 1.2 },
|
|
17
|
+
style: { fill: "#000" },
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
emitPlayback: emitter => {
|
|
21
|
+
emitter.control(emitter.start, state => state.bpmScale.div(2));
|
|
22
|
+
emitter.control(emitter.end, state => state.bpmScale.mul(2));
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ornament } from "../ornament.js";
|
|
2
|
+
export const mordentSymbol = {
|
|
3
|
+
name: "mordent",
|
|
4
|
+
description: "波音:本音、调内上方二度、本音",
|
|
5
|
+
weight: 0.55,
|
|
6
|
+
shapes: [
|
|
7
|
+
{
|
|
8
|
+
path: [
|
|
9
|
+
{ op: "M", x: 3.12541, y: 0.06003 },
|
|
10
|
+
{ op: "C", cx1: 3.18541, cy1: 0.03003, cx2: 3.30541, cy2: 0.00003, x: 3.36541, y: 0.00003 },
|
|
11
|
+
{ op: "C", cx1: 3.66541, cy1: 0.00003, cx2: 3.63541, cy2: -0.02997, x: 5.25541, y: 1.95003 },
|
|
12
|
+
{ op: "L", x: 6.78541, y: 3.78003 },
|
|
13
|
+
{ op: "C", cx1: 6.81541, cy1: 3.78003, cx2: 7.35541, cy2: 2.94003, x: 8.01541, y: 1.95003 },
|
|
14
|
+
{ op: "C", cx1: 9.15541, cy1: 0.27003, cx2: 9.24541, cy2: 0.12003, x: 9.36541, y: 0.06003 },
|
|
15
|
+
{ op: "C", cx1: 9.42541, cy1: 0.03003, cx2: 9.54541, cy2: 0.00003, x: 9.60541, y: 0.00003 },
|
|
16
|
+
{ op: "C", cx1: 9.90541, cy1: 0.00003, cx2: 9.87541, cy2: -0.02997, x: 11.49541, y: 1.95003 },
|
|
17
|
+
{ op: "L", x: 13.02541, y: 3.78003 },
|
|
18
|
+
{ op: "L", x: 13.50541, y: 3.09003 },
|
|
19
|
+
{ op: "C", cx1: 14.01541, cy1: 2.31003, cx2: 14.04541, cy2: 2.25003, x: 14.19541, y: 2.19003 },
|
|
20
|
+
{ op: "C", cx1: 14.61541, cy1: 2.01003, cx2: 15.06541, cy2: 2.34003, x: 15.00541, y: 2.79003 },
|
|
21
|
+
{ op: "C", cx1: 14.97541, cy1: 2.91003, cx2: 14.70541, cy2: 3.30003, x: 13.50541, y: 5.16003 },
|
|
22
|
+
{ op: "C", cx1: 12.12541, cy1: 7.23003, cx2: 12.00541, cy2: 7.38003, x: 11.88541, y: 7.44003 },
|
|
23
|
+
{ op: "C", cx1: 11.82541, cy1: 7.47003, cx2: 11.70541, cy2: 7.50003, x: 11.64541, y: 7.50003 },
|
|
24
|
+
{ op: "C", cx1: 11.34541, cy1: 7.50003, cx2: 11.37541, cy2: 7.53003, x: 9.75541, y: 5.55003 },
|
|
25
|
+
{ op: "L", x: 8.22541, y: 3.72003 },
|
|
26
|
+
{ op: "C", cx1: 8.19541, cy1: 3.72003, cx2: 7.65541, cy2: 4.56003, x: 6.99541, y: 5.55003 },
|
|
27
|
+
{ op: "C", cx1: 5.85541, cy1: 7.23003, cx2: 5.76541, cy2: 7.38003, x: 5.64541, y: 7.44003 },
|
|
28
|
+
{ op: "C", cx1: 5.58541, cy1: 7.47003, cx2: 5.46541, cy2: 7.50003, x: 5.40541, y: 7.50003 },
|
|
29
|
+
{ op: "C", cx1: 5.10541, cy1: 7.50003, cx2: 5.13541, cy2: 7.53003, x: 3.51541, y: 5.55003 },
|
|
30
|
+
{ op: "L", x: 1.98541, y: 3.72003 },
|
|
31
|
+
{ op: "L", x: 1.50541, y: 4.41003 },
|
|
32
|
+
{ op: "C", cx1: 0.99541, cy1: 5.19003, cx2: 0.96541, cy2: 5.25003, x: 0.81541, y: 5.31003 },
|
|
33
|
+
{ op: "C", cx1: 0.39541, cy1: 5.49003, cx2: -0.05459, cy2: 5.16003, x: 0.00541, y: 4.71004 },
|
|
34
|
+
{ op: "C", cx1: 0.03541, cy1: 4.59004, cx2: 0.30541, cy2: 4.20004, x: 1.50541, y: 2.34004 },
|
|
35
|
+
{ op: "C", cx1: 2.88541, cy1: 0.27004, cx2: 3.00541, cy2: 0.12004, x: 3.12541, y: 0.06004 },
|
|
36
|
+
{ op: "L", x: 3.12541, y: 0.06003 },
|
|
37
|
+
{ op: "Z" },
|
|
38
|
+
],
|
|
39
|
+
style: { fill: "#000" },
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
emitPlayback: emitter => emitter.affectFollowing(ornament({ body: [0, 1, 0] })),
|
|
43
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const PIANO_VELOCITY = 48;
|
|
2
|
+
export const pSymbol = {
|
|
3
|
+
name: "p",
|
|
4
|
+
description: "弱",
|
|
5
|
+
shapes: [
|
|
6
|
+
{
|
|
7
|
+
path: [
|
|
8
|
+
{ op: "M", x: 8.93561, y: 0.90391 },
|
|
9
|
+
{ op: "C", cx1: 8.39321, cy1: 0.90391, cx2: 7.93492, cy2: 1.2075, x: 7.56045, y: 1.81442 },
|
|
10
|
+
{ op: "C", cx1: 7.19233, cy1: 2.42134, cx2: 6.91466, cy2: 3.11209, x: 6.72743, y: 3.88032 },
|
|
11
|
+
{ op: "C", cx1: 6.5402, cy1: 4.64856, cx2: 6.45002, cy2: 5.23617, x: 6.45002, y: 5.63655 },
|
|
12
|
+
{ op: "C", cx1: 6.45002, cy1: 6.32093, cx2: 6.66288, cy2: 6.66316, x: 7.0892, y: 6.66316 },
|
|
13
|
+
{ op: "C", cx1: 7.4959, cy1: 6.66316, cx2: 7.88333, cy2: 6.34661, x: 8.2578, y: 5.70743 },
|
|
14
|
+
{ op: "C", cx1: 8.63861, cy1: 5.06825, cx2: 8.94857, cy2: 4.35158, x: 9.18735, y: 3.54473 },
|
|
15
|
+
{ op: "C", cx1: 9.42639, cy1: 2.73762, cx2: 9.54885, cy2: 2.15001, x: 9.54885, y: 1.77554 },
|
|
16
|
+
{ op: "C", cx1: 9.54885, cy1: 1.19453, cx2: 9.34231, cy2: 0.9039, x: 8.93561, y: 0.9039 },
|
|
17
|
+
{ op: "L", x: 8.93561, y: 0.9039 },
|
|
18
|
+
{ op: "L", x: 8.93561, y: 0.9039 },
|
|
19
|
+
{ op: "L", x: 8.93561, y: 0.90391 },
|
|
20
|
+
{ op: "Z" },
|
|
21
|
+
{ op: "M", x: 2.53741, y: 3.99669 },
|
|
22
|
+
{ op: "L", x: 1.90457, y: 3.99669 },
|
|
23
|
+
{ op: "C", cx1: 2.49853, cy1: 2.80215, cx2: 3.08615, cy2: 1.83373, x: 3.66714, y: 1.1041 },
|
|
24
|
+
{ op: "C", cx1: 4.25476, cy1: 0.36813, cx2: 4.97777, cy2: 0.00001, x: 5.84306, y: 0.00001 },
|
|
25
|
+
{ op: "C", cx1: 6.03027, cy1: 0.00001, cx2: 6.21089, cy2: 0.11637, x: 6.39177, y: 0.34882 },
|
|
26
|
+
{ op: "C", cx1: 6.57271, cy1: 0.57466, cx2: 6.66284, cy2: 0.83938, x: 6.66284, y: 1.13636 },
|
|
27
|
+
{ op: "C", cx1: 7.12775, cy1: 0.87825, cx2: 7.5797, cy2: 0.60693, x: 8.08986, y: 0.36812 },
|
|
28
|
+
{ op: "C", cx1: 8.60631, cy1: 0.12932, cx2: 9.01941, cy2: 0, x: 9.49094, y: 0 },
|
|
29
|
+
{ op: "C", cx1: 10.28506, cy1: 0, cx2: 10.85948, cy2: 0.25202, x: 11.22125, y: 0.76189 },
|
|
30
|
+
{ op: "C", cx1: 11.58911, cy1: 1.26568, cx2: 11.76999, cy2: 1.93051, x: 11.76999, y: 2.75058 },
|
|
31
|
+
{ op: "C", cx1: 11.76999, cy1: 3.26045, cx2: 11.66024, cy2: 3.79649, x: 11.44707, y: 4.35819 },
|
|
32
|
+
{ op: "C", cx1: 11.23395, cy1: 4.91989, cx2: 10.93697, cy2: 5.43636, x: 10.55616, y: 5.91423 },
|
|
33
|
+
{ op: "C", cx1: 10.17535, cy1: 6.39186, cx2: 9.73609, cy2: 6.77925, x: 9.23261, y: 7.07623 },
|
|
34
|
+
{ op: "C", cx1: 8.72907, cy1: 7.36686, cx2: 8.19962, cy2: 7.51522, x: 7.64428, y: 7.51522 },
|
|
35
|
+
{ op: "C", cx1: 7.32797, cy1: 7.51522, cx2: 7.0117, cy2: 7.42504, x: 6.68878, y: 7.24416 },
|
|
36
|
+
{ op: "C", cx1: 6.36591, cy1: 7.06327, cx2: 6.10119, cy2: 6.83743, x: 5.89463, y: 6.55976 },
|
|
37
|
+
{ op: "L", x: 4.55177, y: 10.39486 },
|
|
38
|
+
{ op: "C", cx1: 4.59038, cy1: 10.39486, cx2: 4.57108, cy2: 10.42712, x: 4.49359, y: 10.49823 },
|
|
39
|
+
{ op: "C", cx1: 4.55177, cy1: 10.71115, cx2: 4.66151, cy2: 10.82087, x: 4.80987, y: 10.82087 },
|
|
40
|
+
{ op: "L", x: 6.13343, y: 10.82087 },
|
|
41
|
+
{ op: "L", x: 6.13343, y: 11.64096 },
|
|
42
|
+
{ op: "L", x: 0, y: 11.64096 },
|
|
43
|
+
{ op: "L", x: 0, y: 10.82089 },
|
|
44
|
+
{ op: "L", x: 1.3495, y: 10.82089 },
|
|
45
|
+
{ op: "C", cx1: 1.63987, cy1: 10.82089, cx2: 1.95616, cy2: 10.60139, x: 2.00799, y: 10.29146 },
|
|
46
|
+
{ op: "L", x: 5.15868, y: 1.45926 },
|
|
47
|
+
{ op: "L", x: 5.15868, y: 1.29795 },
|
|
48
|
+
{ op: "C", cx1: 5.15868, cy1: 1.05888, cx2: 5.01667, cy2: 0.90391, x: 4.91988, y: 0.90391 },
|
|
49
|
+
{ op: "C", cx1: 4.69378, cy1: 0.90391, cx2: 4.46132, cy2: 1.02662, x: 4.21591, y: 1.27203 },
|
|
50
|
+
{ op: "C", cx1: 3.97076, cy1: 1.51744, cx2: 3.7383, cy2: 1.81442, x: 3.51881, y: 2.16297 },
|
|
51
|
+
{ op: "C", cx1: 3.30566, cy1: 2.51152, cx2: 3.10547, cy2: 2.86033, x: 2.93119, y: 3.20888 },
|
|
52
|
+
{ op: "L", x: 2.53743, y: 3.99669 },
|
|
53
|
+
{ op: "L", x: 2.53743, y: 3.99669 },
|
|
54
|
+
{ op: "L", x: 2.53741, y: 3.99669 },
|
|
55
|
+
{ op: "Z" },
|
|
56
|
+
],
|
|
57
|
+
style: { fill: "#000" },
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
onTimeState: state => { state.velocity = PIANO_VELOCITY; },
|
|
61
|
+
};
|