]>
git.r.bdr.sh - rbdr/lissajous/blob - lib/systems/phase_adjuster.js
120b05d8a854595d0bb36c40159cb8185a6eb3f3
1 import { System
} from '@serpentity/serpentity';
2 import Phased
from '../nodes/phased';
3 import { settingsContainer
, slider
} from '../factories/ui';
13 export default class PhaseAdjuster
extends System
{
15 constructor(container
) {
18 this.container
= container
;
23 this.nodes
= engine
.getNodes(Phased
);
24 this.adjusterContainer
= settingsContainer({
30 for (const node
of this.nodes
) {
31 const nodeElement
= settingsContainer({
32 id: `phase-adjuster-${i}`,
37 ['a', 'b', 'c'].forEach(key
=> {
38 nodeElement
.appendChild(slider({
39 id: `phase-adjuster-${i}-slider-${key}`,
41 max: Math
.PI
.toString(),
43 shiftStep: (Math
.PI
/ 8).toString(),
44 label: internals
.symbols
[key
],
46 get: () => node
.phase
[key
].toString(),
47 set: (value
) => (node
.phase
[key
] = parseFloat(value
))
51 this.adjusterContainer
.appendChild(nodeElement
);
55 this.container
.appendChild(this.adjusterContainer
);
60 this.container
.removeChild(this.adjusterContainer
);
61 delete this.adjusterContainer
;