This commit is contained in:
2023-01-26 20:55:52 +00:00
parent 33f604f5cb
commit 7bd647a7a0
109 changed files with 19909 additions and 15092 deletions

27
src/ts/image.ts Normal file
View File

@@ -0,0 +1,27 @@
export class Image {
image: HTMLImageElement;
constructor(img: HTMLImageElement) {
this.image = img;
}
fadeIn(): void {
this.image.style.opacity = "1";
}
attachEvents(): void {
this.image.addEventListener("load", () => this.fadeIn());
}
start(): void {
if (this.image.dataset.loadTransition === "false") {
return;
}
this.image.style.opacity = "0";
if (this.image.complete) {
this.fadeIn();
} else {
this.attachEvents();
}
}
}