diff --git a/package.json b/package.json index 6d7d01f..4cc6625 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "dependencies": { "@types/three": "^0.153.0", "postcss": "^8.4.25", + "postcss-nesting": "^12.0.0", "sass": "^1.63.6", "svelte-cubed": "^0.2.1", "three": "^0.154.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0460912..c0cbd15 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ dependencies: postcss: specifier: ^8.4.25 version: 8.4.25 + postcss-nesting: + specifier: ^12.0.0 + version: 12.0.0(postcss@8.4.25) sass: specifier: ^1.63.6 version: 1.63.6 @@ -89,6 +92,15 @@ packages: '@jridgewell/trace-mapping': 0.3.18 dev: true + /@csstools/selector-specificity@3.0.0(postcss-selector-parser@6.0.13): + resolution: {integrity: sha512-hBI9tfBtuPIi885ZsZ32IMEU/5nlZH/KOVYJCOh7gyMxaVLGmLedYqFN6Ui1LXkI8JlC8IsuC0rF0btcRZKd5g==} + engines: {node: ^14 || ^16 || >=18} + peerDependencies: + postcss-selector-parser: ^6.0.13 + dependencies: + postcss-selector-parser: 6.0.13 + dev: false + /@esbuild/android-arm64@0.18.11: resolution: {integrity: sha512-snieiq75Z1z5LJX9cduSAjUr7vEI1OdlzFPMw0HH5YI7qQHDd3qs+WZoMrWYDsfRJSq36lIA6mfZBkvL46KoIw==} engines: {node: '>=12'} @@ -842,7 +854,6 @@ packages: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} hasBin: true - dev: true /debug@4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} @@ -1540,6 +1551,17 @@ packages: yaml: 1.10.2 dev: true + /postcss-nesting@12.0.0(postcss@8.4.25): + resolution: {integrity: sha512-knqwW65kxssmyIFadRSimaiRyLVRd0MdwfabesKw6XvGLwSOCJ+4zfvNQQCOOYij5obwpZzDpODuGRv2PCyiUw==} + engines: {node: ^14 || ^16 || >=18} + peerDependencies: + postcss: ^8.4 + dependencies: + '@csstools/selector-specificity': 3.0.0(postcss-selector-parser@6.0.13) + postcss: 8.4.25 + postcss-selector-parser: 6.0.13 + dev: false + /postcss-safe-parser@6.0.0(postcss@8.4.25): resolution: {integrity: sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==} engines: {node: '>=12.0'} @@ -1564,7 +1586,6 @@ packages: dependencies: cssesc: 3.0.0 util-deprecate: 1.0.2 - dev: true /postcss@8.4.25: resolution: {integrity: sha512-7taJ/8t2av0Z+sQEvNzCkpDynl0tX3uJMCODi6nT3PfASC7dYCWV9aQ+uiCf+KBD4SEFcu+GvJdGdwzQ6OSjCw==} @@ -1976,7 +1997,6 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - dev: true /vite@4.4.2(sass@1.63.6): resolution: {integrity: sha512-zUcsJN+UvdSyHhYa277UHhiJ3iq4hUBwHavOpsNUGsTgjBeoBlK8eDt+iT09pBq0h9/knhG/SPrZiM7cGmg7NA==} diff --git a/src/lib/Gyro.svelte b/src/lib/Gyro.svelte index b389eb6..211dd74 100644 --- a/src/lib/Gyro.svelte +++ b/src/lib/Gyro.svelte @@ -1,26 +1,13 @@
diff --git a/src/lib/Requests.ts b/src/lib/Requests.ts index 250c797..668cc2c 100644 --- a/src/lib/Requests.ts +++ b/src/lib/Requests.ts @@ -23,7 +23,11 @@ class RequestsClass { animations = { list: (): Promise => this._get("animations"), - toggle: (name: string): Promise => this._get(`toggle/${name}`) + toggle: (name: string): Promise => this._get(`toggle/${name}`), + //TODO cahnge any + add: (data: any): Promise => this._post('animation', data), + remove: (name: string): Promise => this._get(`delete/${name}`), + get: (name: string): Promise => this._get(`get/${name}`), } active(): Promise { diff --git a/src/lib/Utils.ts b/src/lib/Utils.ts new file mode 100644 index 0000000..7a5d1da --- /dev/null +++ b/src/lib/Utils.ts @@ -0,0 +1,18 @@ +import * as Three from 'three'; + +export type Directions = { + directionX: number, + directionY: number, + directionZ: number, +}; + +function to_rad(degree: number): number { + return (Math.PI / 180) * degree; +} +export function apply_direction(direction: Directions, _vector?: Three.Vector3): Three.Vector3 { + const vector = _vector ?? new Three.Vector3(1,0,0); + return vector + .applyAxisAngle(new Three.Vector3(1, 0, 0), to_rad(direction.directionX)) + .applyAxisAngle(new Three.Vector3(0, 1, 0), to_rad(direction.directionY)) + .applyAxisAngle(new Three.Vector3(0, 0, 1), to_rad(direction.directionZ)); +} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 86bcad4..0e23c50 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,19 +1,34 @@ {#await animations} @@ -22,21 +37,62 @@ {#await active then activeList }
    {#each data as item } -
  • - - {item.name} - - - + Edit +
  • {/each}
{/await} - - new - {/await} + + diff --git a/src/routes/Header.svelte b/src/routes/Header.svelte index 31203e0..fa5e010 100644 --- a/src/routes/Header.svelte +++ b/src/routes/Header.svelte @@ -13,11 +13,32 @@ Configuration +
  • + + New + +
  • diff --git a/src/routes/ani/DisplayData.svelte b/src/routes/ani/DisplayData.svelte new file mode 100644 index 0000000..3577e6e --- /dev/null +++ b/src/routes/ani/DisplayData.svelte @@ -0,0 +1,112 @@ + + + +{#if leds.length > 0} +
    + + {#each colors as color,i } + + {/each} + + + + +
    +{/if} + + diff --git a/src/routes/ani/edit/+page.svelte b/src/routes/ani/edit/+page.svelte new file mode 100644 index 0000000..110d5da --- /dev/null +++ b/src/routes/ani/edit/+page.svelte @@ -0,0 +1,252 @@ + + +
    + {#await data} + Loading... + {:then} + Name:
    + Priority:
    + Repeat:
    + +
    + {#each animation.keyFrames as frame, i} +
    +
    + +
    +
    + Frame: {i}
    + Duration:
    + Settings: +
    + {#each frame.settings as setting, j} +
    + Tags: + Start: + End: +
    +
    +
    + r: + g: + b: +
    + +
    + {/each} +
    +
    +
    + + +
    + {#if i > 0} + + {/if} + {#if i < animation.keyFrames.length - 1} + + {/if} +
    +
    + {/each} +
    + + + {/await} +
    + + diff --git a/src/routes/ani/new/+page.svelte b/src/routes/ani/new/+page.svelte index d5df1e1..e847084 100644 --- a/src/routes/ani/new/+page.svelte +++ b/src/routes/ani/new/+page.svelte @@ -1,10 +1,13 @@ Name:
    Priority:
    Repeat:
    -{#each animation.key_frames as frame, i} +{#each animation.keyFrames as frame, i}
    Frame: {i}
    @@ -45,9 +53,9 @@ Repeat:
    Tags: Start: End: - r: - g: - b: + r: + g: + b:
    {/each} +