Creation de la base du glitcher

This commit is contained in:
2026-04-20 19:00:08 +02:00
parent c10ce7e8d7
commit f1229866d1
9 changed files with 368 additions and 2 deletions
+28
View File
@@ -0,0 +1,28 @@
import { Glitcher } from "./lib/glitcher";
const UI_GLITCHER = new Glitcher(document.getElementById("ui-canvas"))
const FORM = document.getElementById("glitcher-form")
async function updateFromForm(){
let data = new FormData(FORM)
let image = data.get("image")
if(image){
await UI_GLITCHER.setImage(image)
} else {
UI_GLITCHER.clearImage()
}
UI_GLITCHER.render()
}
for(let el of FORM.elements){
el.addEventListener("change", () => FORM.requestSubmit())
}
FORM.addEventListener("submit", e => {
e.preventDefault()
updateFromForm()
})
updateFromForm()