Skip to content

Commit

Permalink
Merge pull request #12 from ruben-salgado/feature/issue11
Browse files Browse the repository at this point in the history
[ADD] Arranque
  • Loading branch information
ruben-salgado committed Apr 6, 2021
2 parents 11b2e7f + 5e2c2dd commit 7484049
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/app.mjs
Original file line number Diff line number Diff line change
@@ -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)
Empty file added src/images/.gitkeep
Empty file.
Empty file added src/styles/components/.gitkeep
Empty file.

0 comments on commit 7484049

Please sign in to comment.