aboutsummaryrefslogtreecommitdiff
path: root/lib/factories
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2024-05-08 18:37:48 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2024-05-08 18:37:48 +0200
commit32e2eed2a003c9be98f344ae70248139162b6969 (patch)
tree7883586f5b106a569c58bc74c3fa17f780176f27 /lib/factories
parent2b9badac1345c865c34097bc5d1699329b53fdc8 (diff)
Add a few commentsHEADmain
Diffstat (limited to 'lib/factories')
-rw-r--r--lib/factories/curves.js7
-rw-r--r--lib/factories/global.js12
-rw-r--r--lib/factories/ui.js12
3 files changed, 31 insertions, 0 deletions
diff --git a/lib/factories/curves.js b/lib/factories/curves.js
index f6db460..b5d6c84 100644
--- a/lib/factories/curves.js
+++ b/lib/factories/curves.js
@@ -5,6 +5,13 @@ import TriplePhase from '../components/triple_phase';
import TripleAmplitude from '../components/triple_amplitude';
import Color from '../components/color';
+/**
+ * This file is a factory for curves.
+ */
+
+/**
+ * Creates a lissajous curve entity
+ */
export function lissajousCurve() {
const entity = new Entity();
diff --git a/lib/factories/global.js b/lib/factories/global.js
index bf0360d..4f36a8e 100644
--- a/lib/factories/global.js
+++ b/lib/factories/global.js
@@ -6,6 +6,15 @@ import Radius from '../components/radius';
import Up from '../components/up';
import Configuration from '../components/configuration';
+/**
+ * This file is a factory for global objects. It doesn't enforce it, but
+ * there should be only one of these entities in the engine at a given
+ * time.
+ */
+
+/**
+ * Creates a data entity that holds the configuration.
+ */
export function configuration() {
const entity = new Entity();
@@ -14,6 +23,9 @@ export function configuration() {
return entity;
}
+/**
+ * Creates a camera, used to modify the 3D view.
+ */
export function camera() {
const entity = new Entity();
diff --git a/lib/factories/ui.js b/lib/factories/ui.js
index cc34579..167c618 100644
--- a/lib/factories/ui.js
+++ b/lib/factories/ui.js
@@ -1,3 +1,10 @@
+/**
+ * This file is a factory for DOM UI elements.
+ */
+
+/**
+ * Returns a settings container that includes a section and a heading.
+ */
export function settingsContainer({id, label, level=2}) {
const container = document.createElement('section');
@@ -6,6 +13,11 @@ export function settingsContainer({id, label, level=2}) {
return container;
};
+/**
+ * Returns a slider that includes a label, and can optionally be set to
+ * "shift" to a different step. (eg. we use this for π mode, where frequency
+ * and amplitude are mapped to π/8 increments.
+ */
export function slider({
id,
min,