]>
git.r.bdr.sh - rbdr/lissajous/blob - lib/systems/frequency_adjuster.js
6aa11d4f98343918fb770e5da9f21fc5bf83c72f
1 import { System
} from '@serpentity/serpentity';
2 import Frequent
from '../nodes/frequent';
3 import { settingsContainer
, slider
} from '../factories/ui';
13 export default class FrequencyAdjuster
extends System
{
15 constructor(container
) {
18 this.container
= container
;
23 this.nodes
= engine
.getNodes(Frequent
);
24 this.adjusterContainer
= settingsContainer({
25 id: 'frequency-adjuster',
30 for (const node
of this.nodes
) {
31 const nodeElement
= settingsContainer({
32 id: `frequency-adjuster-${i}`,
37 ['a', 'b', 'c'].forEach(key
=> {
38 nodeElement
.appendChild(slider({
42 label: internals
.symbols
[key
],
43 className: `frequency`,
44 get: () => node
.frequency
[key
].toString(),
45 set: (value
) => (node
.frequency
[key
] = parseFloat(value
))
49 this.adjusterContainer
.appendChild(nodeElement
);
53 this.container
.appendChild(this.adjusterContainer
);
58 this.container
.removeChild(this.adjusterContainer
);
59 delete this.adjusterContainer
;