simple-circuit-engine 0.0.10 → 0.0.12
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/AGENTS.md +13 -7
- package/CLAUDE.md +16 -103
- package/README.md +8 -5
- package/dist/core/index.d.ts +2 -23
- package/dist/core/index.js +75 -2000
- package/dist/core/setup.d.ts +17 -0
- package/dist/core/simulation/CircuitRunner.d.ts +176 -0
- package/dist/core/simulation/DirtyTracker.d.ts +87 -0
- package/dist/core/simulation/EventQueue.d.ts +68 -0
- package/dist/core/simulation/StateManager.d.ts +100 -0
- package/dist/core/simulation/behaviors/BehaviorRegistry.d.ts +70 -0
- package/dist/core/simulation/behaviors/ComponentBehavior.d.ts +53 -0
- package/dist/core/simulation/behaviors/basic/BatteryBehavior.d.ts +14 -0
- package/dist/core/simulation/behaviors/basic/ClockBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/DoubleThrowSwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/LightbulbBehavior.d.ts +23 -0
- package/dist/core/simulation/behaviors/basic/RectangleLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/RelayBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/SmallLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/SwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/index.d.ts +20 -0
- package/dist/core/simulation/behaviors/gates/InverterBehavior.d.ts +29 -0
- package/dist/core/simulation/behaviors/gates/Nand4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nand8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NandGateBehavior.d.ts +28 -0
- package/dist/core/simulation/behaviors/gates/Nor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/Xor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Xor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/XorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/index.d.ts +34 -0
- package/dist/core/simulation/behaviors/index.d.ts +24 -0
- package/dist/core/simulation/behaviors/types.d.ts +101 -0
- package/dist/core/simulation/index.d.ts +18 -0
- package/dist/core/simulation/states/ComponentState.d.ts +57 -0
- package/dist/core/simulation/states/SimulationState.d.ts +46 -0
- package/dist/core/simulation/states/basic/BatteryState.d.ts +16 -0
- package/dist/core/simulation/states/basic/ClockState.d.ts +16 -0
- package/dist/core/simulation/states/basic/DoubleThrowSwitchState.d.ts +21 -0
- package/dist/core/simulation/states/basic/LightbulbState.d.ts +21 -0
- package/dist/core/simulation/states/basic/RectangleLEDState.d.ts +9 -0
- package/dist/core/simulation/states/basic/RelayState.d.ts +25 -0
- package/dist/core/simulation/states/basic/SmallLEDState.d.ts +21 -0
- package/dist/core/simulation/states/basic/SwitchState.d.ts +25 -0
- package/dist/core/simulation/states/gates/InverterState.d.ts +17 -0
- package/dist/core/simulation/states/gates/Nand4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nand8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NandGateState.d.ts +16 -0
- package/dist/core/simulation/states/gates/Nor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/XorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/index.d.ts +25 -0
- package/dist/core/simulation/states/index.d.ts +26 -0
- package/dist/core/simulation/states/types.d.ts +32 -0
- package/dist/core/simulation/types.d.ts +155 -0
- package/dist/core/topology/Circuit.d.ts +420 -0
- package/dist/core/topology/CircuitMetadata.d.ts +24 -0
- package/dist/core/topology/CircuitOptions.d.ts +14 -0
- package/dist/core/topology/Component.d.ts +152 -0
- package/dist/core/topology/ENode.d.ts +200 -0
- package/dist/core/topology/Wire.d.ts +130 -0
- package/dist/core/topology/delays.d.ts +52 -0
- package/dist/core/topology/index.d.ts +14 -0
- package/dist/core/topology/types.d.ts +175 -0
- package/dist/core/utils/CameraOptions.d.ts +83 -0
- package/dist/core/utils/MemoizeDecorator.d.ts +9 -0
- package/dist/core/utils/Position.d.ts +166 -0
- package/dist/core/utils/Position3D.d.ts +77 -0
- package/dist/core/utils/Rotation.d.ts +82 -0
- package/dist/core/utils/index.d.ts +24 -0
- package/dist/core/utils/types.d.ts +35 -0
- package/dist/core-Bjta9Y7_.js +2707 -0
- package/dist/core-Bjta9Y7_.js.map +1 -0
- package/dist/index.d.ts +13 -6286
- package/dist/index.js +120 -100
- package/dist/scene/CircuitEngine.d.ts +270 -0
- package/dist/scene/index.d.ts +1 -2
- package/dist/scene/index.js +44 -38
- package/dist/scene/setup.d.ts +18 -0
- package/dist/scene/shared/AbstractCircuitController.d.ts +211 -0
- package/dist/scene/shared/BranchingPointVisualFactory.d.ts +70 -0
- package/dist/scene/shared/EventEmitter.d.ts +92 -0
- package/dist/scene/shared/HoverManager.d.ts +151 -0
- package/dist/scene/shared/SelectionManager.d.ts +159 -0
- package/dist/scene/shared/WireVisualManager.d.ts +242 -0
- package/dist/scene/shared/components/ComponentVisualFactory.d.ts +438 -0
- package/dist/scene/shared/components/DefaultVisualFactory.d.ts +51 -0
- package/dist/scene/shared/components/FactoryRegistry.d.ts +84 -0
- package/dist/scene/shared/components/GroupedFactoryRegistry.d.ts +153 -0
- package/dist/scene/shared/components/basic/BatteryVisualFactory.d.ts +13 -0
- package/dist/scene/shared/components/basic/ClockVisualFactory.d.ts +79 -0
- package/dist/scene/shared/components/basic/DoubleThrowSwitchVisualFactory.d.ts +87 -0
- package/dist/scene/shared/components/basic/LabelVisualFactory.d.ts +148 -0
- package/dist/scene/shared/components/basic/LightbulbVisualFactory.d.ts +72 -0
- package/dist/scene/shared/components/basic/RectangleLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/RelayVisualFactory.d.ts +92 -0
- package/dist/scene/shared/components/basic/SmallLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/SwitchVisualFactory.d.ts +85 -0
- package/dist/scene/shared/components/gates/InverterVisualFactory.d.ts +104 -0
- package/dist/scene/shared/components/gates/Nand4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nand8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NandGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Nor4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nor8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NorGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Xor4GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/Xor8GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/XorGateVisualFactory.d.ts +103 -0
- package/dist/scene/shared/components/index.d.ts +29 -0
- package/dist/scene/shared/components/types.d.ts +43 -0
- package/dist/scene/shared/types.d.ts +476 -0
- package/dist/scene/shared/utils/CameraUtils.d.ts +23 -0
- package/dist/scene/shared/utils/ColorUtils.d.ts +26 -0
- package/dist/scene/shared/utils/ControlsUtils.d.ts +8 -0
- package/dist/scene/shared/utils/GeometryUtils.d.ts +261 -0
- package/dist/scene/shared/utils/LayerConstants.d.ts +40 -0
- package/dist/scene/shared/utils/LightingUtils.d.ts +31 -0
- package/dist/scene/shared/utils/MaterialUtils.d.ts +73 -0
- package/dist/scene/shared/utils/Options.d.ts +16 -0
- package/dist/scene/simulation/CircuitRunnerController.d.ts +227 -0
- package/dist/scene/static/CircuitController.d.ts +227 -0
- package/dist/scene/static/CircuitWriter.d.ts +146 -0
- package/dist/scene/static/PinTooltipWidget.d.ts +26 -0
- package/dist/scene/static/tools/BuildTool.d.ts +286 -0
- package/dist/scene/static/tools/ComponentPickerWidget.d.ts +82 -0
- package/dist/scene/static/tools/ConfigPanelWidget.d.ts +93 -0
- package/dist/scene/static/tools/MultiSelectTool.d.ts +265 -0
- package/dist/scene-CVsDdySt.js +7357 -0
- package/dist/scene-CVsDdySt.js.map +1 -0
- package/package.json +24 -25
- package/dist/CircuitRunner-DEb7JdNf.js +0 -1809
- package/dist/CircuitRunner-DEb7JdNf.js.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/scene/index.js.map +0 -1
- package/dist/setup-AB1vFiis.js +0 -9918
- package/dist/setup-AB1vFiis.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -9,9 +9,10 @@ Educational electronic / computer circuit Build & Simulation engine with THREE.j
|
|
|
9
9
|
## Quick Start
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
import { WebGLRenderer } from 'three';
|
|
12
|
+
import { WebGLRenderer, Clock } from 'three';
|
|
13
13
|
import {
|
|
14
14
|
Circuit,
|
|
15
|
+
CircuitOptions,
|
|
15
16
|
BehaviorRegistry,
|
|
16
17
|
registerBasicComponentsBehaviors,
|
|
17
18
|
registerGatesComponentsBehaviors,
|
|
@@ -38,6 +39,8 @@ registerGatesComponentsBehaviors(behaviorRegistry); //... other groupsof compone
|
|
|
38
39
|
const engine = new CircuitEngine(componentsFactoryRegistry, behaviorRegistry);
|
|
39
40
|
const container = document.getElementById('canvas-container')!;
|
|
40
41
|
engine.initialize(container, engineOptions());
|
|
42
|
+
// set engine circuit to a new empty circuit
|
|
43
|
+
engine.setCircuit(new Circuit(new CircuitOptions()));
|
|
41
44
|
|
|
42
45
|
// Rendering
|
|
43
46
|
const renderer = new WebGLRenderer();
|
|
@@ -47,11 +50,15 @@ renderer.setSize(container.clientWidth, container.clientHeight);
|
|
|
47
50
|
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
48
51
|
// Append renderer to DOM
|
|
49
52
|
container.appendChild(renderer.domElement);
|
|
50
|
-
|
|
53
|
+
|
|
54
|
+
// Animation loop
|
|
55
|
+
const clock = new Clock();
|
|
51
56
|
function animate() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
requestAnimationFrame(animate);
|
|
58
|
+
const delta = clock.getDelta();
|
|
59
|
+
engine.update(delta);
|
|
60
|
+
engine.getControls().update();
|
|
61
|
+
renderer.render(engine.getScene(), engine.getCamera());
|
|
55
62
|
}
|
|
56
63
|
animate();
|
|
57
64
|
```
|
|
@@ -153,7 +160,6 @@ engine.on('simulationTick', (state) => { ... });
|
|
|
153
160
|
|
|
154
161
|
```json
|
|
155
162
|
{
|
|
156
|
-
"three": "^0.
|
|
157
|
-
"lil-gui": "^0.21.0"
|
|
163
|
+
"three": "^0.183.2"
|
|
158
164
|
}
|
|
159
165
|
```
|
package/CLAUDE.md
CHANGED
|
@@ -4,12 +4,19 @@ Provide a simple and easy-to-use electronic circuit simulation library for educa
|
|
|
4
4
|
It allows users to create, edit and simulate electronic circuits in a web environment.
|
|
5
5
|
The library should be easily importable and usable in client applications and follow open-source typeScript libraries good practices.
|
|
6
6
|
|
|
7
|
-
Last updated: 2026-
|
|
7
|
+
Last updated: 2026-03-14
|
|
8
|
+
|
|
9
|
+
## Goals and principles
|
|
10
|
+
|
|
11
|
+
To provide a vulgarization library that teaches the frontier between electronics and low level coding.
|
|
12
|
+
The electrical model is very simplified (no level of voltage/current, resistance, capacitance or inductance, type or frequency of current)
|
|
13
|
+
and reduced to a logic state (has voltage/electrons sink true or false, has ground/electrons source true or false)/event engine.
|
|
14
|
+
However, it aims to teach real-world electronic design principles so modeling of components propagation delay and logic families is emphasized.
|
|
8
15
|
|
|
9
16
|
## Active Technologies
|
|
10
17
|
|
|
11
|
-
- TypeScript
|
|
12
|
-
- Three.js 0.
|
|
18
|
+
- TypeScript 6.0+ (strict mode), targeting ES2022
|
|
19
|
+
- Three.js 0.183+ (scene, camera, controls, 3D objects, Line2)
|
|
13
20
|
- lil-gui as helper for small interactive modal forms
|
|
14
21
|
- in-memory circuit model, optional loading/saving from/to a JSON file
|
|
15
22
|
|
|
@@ -17,78 +24,18 @@ Last updated: 2026-01-18
|
|
|
17
24
|
|
|
18
25
|
Simple Circuit Engine follows a **Model-Controller** architecture with clear separation between:
|
|
19
26
|
|
|
20
|
-
- **Core module** (`src/core/`): Pure TypeScript domain **Model** and simulation engine (no dependencies)
|
|
21
|
-
- **Scene module** (`src/scene/`): Three.js visualization layer with editing **
|
|
27
|
+
- **Core module** (`src/core/`): Pure TypeScript domain **Model** and simulation engine (no dependencies).
|
|
28
|
+
- **Scene module** (`src/scene/`): Three.js visualization layer with editing **Controller** and its tools and the simulation animated **Controller**.
|
|
22
29
|
|
|
23
30
|
### Core Module (`src/core/`)
|
|
24
31
|
|
|
25
|
-
The core module is **dependency-free** and contains all domain logic
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
src/core/
|
|
29
|
-
+-- Circuit.ts # Central model: manages the three elements of the circuit : components, enodes, and wires
|
|
30
|
-
+-- Component.ts # Electrical component (battery, switch, LED, etc.)
|
|
31
|
-
+-- ENode.ts # Electrical node (Pin or BranchingPoint)
|
|
32
|
-
+-- Wire.ts # Connection between two enodes
|
|
33
|
-
+-- Position.ts # 2D grid position
|
|
34
|
-
+-- Rotation.ts # Discrete rotation
|
|
35
|
-
+-- types/
|
|
36
|
-
| +-- ComponentType.ts # Component type enum and metadata
|
|
37
|
-
| +-- ENodeSourceType.ts # Voltage/Current source types
|
|
38
|
-
| +-- ENodeType.ts # Pin vs BranchingPoint
|
|
39
|
-
| +-- Identifier.ts # UUID type alias
|
|
40
|
-
+-- simulation/
|
|
41
|
-
| +-- CircuitRunner.ts # Tick-based simulation orchestrator
|
|
42
|
-
| +-- DirtyTracker.ts # Utility used by CircuitRunner to keep tracks of simulation changed components (optimization)
|
|
43
|
-
| +-- EventQueue.ts # Used by CircuitRunner to queue simulation delayed transitions events
|
|
44
|
-
| +-- SimulationState.ts # Data Class representing the simulation state of entire circuit at a given time
|
|
45
|
-
| +-- StateManager.ts # Utility used by CircuitRunner to manage SimulationState updates
|
|
46
|
-
| +-- states/
|
|
47
|
-
| +-- ComponentState.ts # Abstract class for component state
|
|
48
|
-
| +-- ... # Components states
|
|
49
|
-
| +-- behaviors/
|
|
50
|
-
| +-- BehaviorRegistry.ts # Maps component types to behaviors
|
|
51
|
-
| +-- ComponentBehavior.ts # Interface for component logic
|
|
52
|
-
| +-- SwitchBehavior.ts # Switch toggle logic
|
|
53
|
-
| +-- ... # Other components behaviors
|
|
54
|
-
| +-- types/ # Various enums, data classes ...
|
|
55
|
-
+-- setup.ts # Helper to register behaviors
|
|
56
|
-
+-- index.ts # Public API exports
|
|
57
|
-
```
|
|
32
|
+
The core module is **dependency-free** and contains all domain logic.
|
|
33
|
+
Refer to its [CLAUDE.md](src/core/CLAUDE.md) for more details.
|
|
58
34
|
|
|
59
35
|
### Scene Module (`src/scene/`)
|
|
60
36
|
|
|
61
|
-
The scene module handles Three.js visualization and
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
src/scene/
|
|
65
|
-
+-- CircuitEngine.ts # Unified facade with mode switching
|
|
66
|
-
+-- static/
|
|
67
|
-
| +-- CircuitController.ts # Edit mode controller
|
|
68
|
-
| +-- CircuitWriter.ts # Writes scene changes to core model
|
|
69
|
-
| +-- SelectionManager.ts # Tracks selected elements
|
|
70
|
-
| +-- tools/
|
|
71
|
-
| +-- BuildTool.ts # Unified build tool (state machine)
|
|
72
|
-
| +-- ComponentPickerWidget.ts # Widget for selecting component to add in BuildTool
|
|
73
|
-
| +-- ConfigPanelWidget.ts # Widget for changing components configuration
|
|
74
|
-
| +-- MultiSelectTool.ts # Rectangle selection + bulk operations
|
|
75
|
-
+-- simulation/
|
|
76
|
-
| +-- CircuitRunnerController.ts # Simulation mode controller
|
|
77
|
-
+-- shared/
|
|
78
|
-
| +-- AbstractCircuitController.ts # Base controller class
|
|
79
|
-
| +-- EventEmitter.ts # Type-safe event system
|
|
80
|
-
| +-- HoverManager.ts # Raycasting hover detection
|
|
81
|
-
| +-- WireVisualManager.ts # Wire Line2 visuals
|
|
82
|
-
| +-- BranchingPointVisualFactory.ts # BP visuals
|
|
83
|
-
| +-- components/
|
|
84
|
-
| | +-- ComponentVisualFactory.ts # Interface + base class
|
|
85
|
-
| | +-- GroupedFactoryRegistry.ts # Register groups of components referencing types and their visual factories
|
|
86
|
-
| | +-- ... # Components factories
|
|
87
|
-
| +-- types.ts # Shared type definitions
|
|
88
|
-
| +-- utils/ # Geometry, camera, lighting utilities
|
|
89
|
-
+-- setup.ts # Helper to register factories
|
|
90
|
-
+-- index.ts # Public API exports
|
|
91
|
-
```
|
|
37
|
+
The scene module handles Three.js visualization, user interaction and simulation animation.
|
|
38
|
+
Refer to its [CLAUDE.md](src/scene/CLAUDE.md) for more details.
|
|
92
39
|
|
|
93
40
|
## Testing strategy
|
|
94
41
|
|
|
@@ -105,37 +52,3 @@ npm test && npm run lint
|
|
|
105
52
|
## Code Style
|
|
106
53
|
|
|
107
54
|
TypeScript (strict mode), targeting ES2022: Follow standard conventions
|
|
108
|
-
When possible level of nested conditional structures should be minimized by using guard clauses and early returns. Examples below:
|
|
109
|
-
|
|
110
|
-
```typescript
|
|
111
|
-
/**
|
|
112
|
-
* GOOD practice for minimizing nested conditionals
|
|
113
|
-
* DO that because clearer, reduced learning/debugging overhead
|
|
114
|
-
* @param input
|
|
115
|
-
*/
|
|
116
|
-
function goodExample(input: number | null): string {
|
|
117
|
-
if (input === null) {
|
|
118
|
-
// early return in this case
|
|
119
|
-
return 'No input provided';
|
|
120
|
-
}
|
|
121
|
-
// process securized input
|
|
122
|
-
// Main logic (possibly big) continues here without additional nesting
|
|
123
|
-
let output = input * 2;
|
|
124
|
-
|
|
125
|
-
return `Output is ${output}`;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* BAD practice that increases nested conditionals
|
|
129
|
-
* DON'T do that because less clear, increased learning/debugging overhead
|
|
130
|
-
* @param input
|
|
131
|
-
*/
|
|
132
|
-
function badExample(input: number | null): string {
|
|
133
|
-
if (input !== null) {
|
|
134
|
-
// Main logic (possibly big) embedded under an if :
|
|
135
|
-
let output = input * 2;
|
|
136
|
-
return `Output is ${output}`;
|
|
137
|
-
} else {
|
|
138
|
-
return 'No input provided';
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
```
|
package/README.md
CHANGED
|
@@ -35,8 +35,8 @@ In addition to `simple-circuit-engine` you must import the `three` and `lil-gui`
|
|
|
35
35
|
This code set up the main CircuitEngine instance in edit mode on a new Circuit, handles THREE.js objects creation and rendering/animation in the canva-container HTML element.
|
|
36
36
|
|
|
37
37
|
```javascript
|
|
38
|
-
import { WebGLRenderer } from 'three';
|
|
39
|
-
import { Circuit, BehaviorRegistry, registerBasicComponentsBehaviors } from 'simple-circuit-engine/core';
|
|
38
|
+
import { WebGLRenderer, Clock } from 'three';
|
|
39
|
+
import { Circuit, CircuitOptions, BehaviorRegistry, registerBasicComponentsBehaviors } from 'simple-circuit-engine/core';
|
|
40
40
|
import { CircuitEngine, engineOptions, GroupedFactoryRegistry, DefaultVisualFactory, registerBasicComponentsBehaviors } from 'simple-circuit-engine/scene';
|
|
41
41
|
|
|
42
42
|
// Create component factory registry with basic components visual factories (for scene objects creation - rendering)
|
|
@@ -50,8 +50,8 @@ const behaviorRegistry = registerBasicComponentsBehaviors(new BehaviorRegistry()
|
|
|
50
50
|
const container = document.getElementById('canva-container')!;
|
|
51
51
|
const engine = new CircuitEngine(componentsFactoryRegistry, behaviorRegistry);
|
|
52
52
|
engine.initialize(container, engineOptions());
|
|
53
|
-
// set engine circuit to a new empty circuit
|
|
54
|
-
engine.setCircuit(new Circuit());
|
|
53
|
+
// set engine circuit to a new empty circuit
|
|
54
|
+
engine.setCircuit(new Circuit(new CircuitOptions()));
|
|
55
55
|
|
|
56
56
|
// Create and setup WebGL renderer
|
|
57
57
|
const renderer = new WebGLRenderer({ antialias: true, alpha: false });
|
|
@@ -62,9 +62,12 @@ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
|
62
62
|
// Append renderer to DOM
|
|
63
63
|
container.appendChild(renderer.domElement);
|
|
64
64
|
|
|
65
|
-
// Animation loop
|
|
65
|
+
// Animation loop
|
|
66
|
+
const clock = new Clock();
|
|
66
67
|
function animate() {
|
|
67
68
|
requestAnimationFrame(animate);
|
|
69
|
+
const delta = clock.getDelta();
|
|
70
|
+
engine.update(delta);
|
|
68
71
|
engine.getControls().update();
|
|
69
72
|
renderer.render(engine.getScene(), engine.getCamera());
|
|
70
73
|
}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -20,28 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* @packageDocumentation
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export type { ComponentTypeMetadata } from './types/ComponentType.js';
|
|
26
|
-
export { ComponentType, COMPONENT_TYPE_METADATA, getAllComponentTypes, getComponentTypeMetadata, } from './types/ComponentType.js';
|
|
27
|
-
export { ENodeSourceType } from './types/ENodeSourceType.js';
|
|
28
|
-
export { ENodeType } from './types/ENodeType.js';
|
|
29
|
-
export type { UUID } from './types/Identifier.js';
|
|
30
|
-
export { generateUUID } from './types/Identifier.js';
|
|
31
|
-
export { Position, findPositionBestIndex, simplifyPositions } from './types/Position.js';
|
|
32
|
-
export { Position3D } from './types/Position3D.js';
|
|
33
|
-
export type { IPosition3D } from './types/Position3D.js';
|
|
34
|
-
export { Rotation } from './types/Rotation.js';
|
|
35
|
-
export { Circuit, CircuitMetadata } from './Circuit.js';
|
|
36
|
-
export type { ICircuitMetadata } from './Circuit.js';
|
|
37
|
-
export { Component } from './Component.js';
|
|
38
|
-
export { ENode } from './ENode.js';
|
|
39
|
-
export { Wire } from './Wire.js';
|
|
40
|
-
export type * from './simulation/index.js';
|
|
23
|
+
export * from './utils/index.js';
|
|
24
|
+
export * from './topology/index.js';
|
|
41
25
|
export * from './simulation/index.js';
|
|
42
|
-
export type * from './simulation/states/index.js';
|
|
43
|
-
export * from './simulation/states/index.js';
|
|
44
|
-
export type * from './simulation/behaviors/index.js';
|
|
45
|
-
export * from './simulation/behaviors/index.js';
|
|
46
26
|
export * from './setup.js';
|
|
47
|
-
//# sourceMappingURL=index.d.ts.map
|