From 4cf128e42d39c804f2bdcb4452b5c03d764ed8cd Mon Sep 17 00:00:00 2001 From: Yikuan Sun Date: Tue, 9 Jul 2024 09:16:23 -0400 Subject: [PATCH] Create texture selector UI --- src/lib/styles/global.css | 3 +- src/routes/+page.svelte | 64 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/lib/styles/global.css b/src/lib/styles/global.css index 3189bb7..b7b4913 100644 --- a/src/lib/styles/global.css +++ b/src/lib/styles/global.css @@ -86,8 +86,9 @@ button:hover, ::-webkit-file-upload-button:hover { border-color: #00AA00; } -option { +option, optgroup { background-color: #222222; + color: #00AA00; } #guicontainer { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 97857c7..029c289 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -7,6 +7,15 @@ import Slider from "$lib/Slider.svelte"; import starTexture from "$lib/textures/Star.png"; import orbTexture from "$lib/textures/Orb.png"; + import matrixTexture from "$lib/textures/Bit Rain.png"; + import bokehTexture from "$lib/textures/Bokeh.png"; + import debrisTexture from "$lib/textures/Debris.png"; + import lensFlareTexture from "$lib/textures/Lens Flare.png"; + import plasmaTexture from "$lib/textures/Plasma.png"; + import smokeTexture from "$lib/textures/Smoke.png"; + import starfieldTexture from "$lib/textures/Starfield.png"; + import explosionTexture from "$lib/textures/Explosion.png"; + import cosmicEnergyTexture from "$lib/textures/Cosmic Energy.png"; import canvasClickDrag from "$lib/canvasClickDrag.js"; import Collapsible from "$lib/Collapsible.svelte"; import Square from "$lib/Square.svelte"; @@ -179,6 +188,8 @@ let previewBg = "transparent"; let exportButtonReal; + + let fileInputs = {};
@@ -226,6 +237,59 @@ -->
+ + {#each userOptions["textureURLs"] as tex, i} + { + if (!e.target.files.length) return; + let file = e.target.files[0]; + let fR = new FileReader(); + fR.addEventListener("loadend", (e2) => { + userOptions["textureURLs"][i] = e2.target.result; + tick(); + }); + fR.readAsDataURL(file); + }} /> + + {#if i > 0} + + {/if} +
+ {/each} + +
X
Y