From 22b149306a2407110dc0a8c55112a1df9459c28c Mon Sep 17 00:00:00 2001 From: Ruben Salgado Ramirez Date: Mon, 5 Apr 2021 20:59:12 -0500 Subject: [PATCH 1/3] [ADD] Archivo app --- src/app.mjs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/app.mjs diff --git a/src/app.mjs b/src/app.mjs new file mode 100644 index 0000000..cb40276 --- /dev/null +++ b/src/app.mjs @@ -0,0 +1,43 @@ +"use strict"; + +import './styles/common.sass'; + +import * as dat from 'dat.gui'; + +const CONFIG = { + 'rotate-x': 0, + 'rotate-y': 0, +} + +const BOUNDS = { + 'rotate-x': [-360, 360, 1], + 'rotate-y': [-360, 360, 1], +} + +const CONTROLLER = new dat.GUI() + +const UPDATE = () => { + for (const KEY of Object.keys(CONFIG)) { + document.documentElement.style.setProperty(`--${KEY}`, CONFIG[KEY]) + } +} + +const digest = (CONFIG_OBJECT, BOUNDS_OBJECT, FOLDER) => { + for (const category in BOUNDS_OBJECT) { + if (Array.isArray(BOUNDS_OBJECT[category])) { + FOLDER.add( + CONFIG_OBJECT, + category, + BOUNDS_OBJECT[category][0], + BOUNDS_OBJECT[category][1], + BOUNDS_OBJECT[category][2] ? BOUNDS_OBJECT[category][2] : 1 + ).onChange(UPDATE) + } else { + const NEW_FOLDER = FOLDER + ? FOLDER.addFolder(category) + : GUI.addFolder(category) + digest(CONFIG_OBJECT[category], BOUNDS_OBJECT[category], NEW_FOLDER) + } + } +} +digest(CONFIG, BOUNDS, CONTROLLER) From f8295cc1ccf44f91bbf511f6e5cb7ec0abc42507 Mon Sep 17 00:00:00 2001 From: Ruben Salgado Ramirez Date: Mon, 5 Apr 2021 20:59:28 -0500 Subject: [PATCH 2/3] [ADD] Carpeta images --- src/images/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/images/.gitkeep diff --git a/src/images/.gitkeep b/src/images/.gitkeep new file mode 100644 index 0000000..e69de29 From 5e2c2dd2a0b8bb55c061ba543c70c3aa72e1e711 Mon Sep 17 00:00:00 2001 From: Ruben Salgado Ramirez Date: Mon, 5 Apr 2021 20:59:53 -0500 Subject: [PATCH 3/3] [ADD] Carpeta styles/components. Close #11 --- src/styles/components/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/styles/components/.gitkeep diff --git a/src/styles/components/.gitkeep b/src/styles/components/.gitkeep new file mode 100644 index 0000000..e69de29