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