Shimeji with physics added !!!!!
This commit is contained in:
+12
-21
@@ -3,44 +3,35 @@
|
||||
import { PASSWD } from "$lib/stores/bash/etc/userData";
|
||||
import { ArrowRight, ChevronLeft, ChevronRight, CircleAlert, Lock } from "@lucide/svelte";
|
||||
import type { effect } from "zod/v3";
|
||||
|
||||
|
||||
let formElem: HTMLElement;
|
||||
let {init, form}: { init: (formData: FormData) => void, form: any} = $props();
|
||||
|
||||
|
||||
const USERS = PASSWD.filter((user) => user.accesible == true);
|
||||
const basePath: string = '/src/lib/assets/login/';
|
||||
|
||||
let userIndex: number = $state(3);
|
||||
|
||||
$inspect(userIndex);
|
||||
|
||||
let username: string = $state('gornodox');
|
||||
let userImage: string = $derived(`${basePath}${username}.png`);
|
||||
|
||||
function changeUser(direction: 0 | 1) {
|
||||
if(direction === 0) {
|
||||
userIndex--;
|
||||
document.getElementById('username')?.classList.add('switchR');
|
||||
}
|
||||
else {
|
||||
userIndex++;
|
||||
document.getElementById('username')?.classList.add('switchL');
|
||||
}
|
||||
if(userIndex >= PASSWD.length) userIndex = 0;
|
||||
if(userIndex < 0) userIndex = PASSWD.length - 1;
|
||||
if(direction === 0) userIndex--;
|
||||
else userIndex++;
|
||||
|
||||
|
||||
if(userIndex >= USERS.length) userIndex = 0;
|
||||
if(userIndex < 0) userIndex = USERS.length - 1;
|
||||
|
||||
const user = PASSWD[userIndex];
|
||||
const user = USERS[userIndex];
|
||||
username = user.username;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="wrapper" class=" flex flex-col items-center" class:outro={form?.success}>
|
||||
<img class="rounded-full mb-4 border-primary-dark border-2" src={userImage} alt="" width="80" height="80" />
|
||||
<img class="rounded-full mb-4 border-primary-dark border-2" src={`${basePath}${username}.png`} onerror={(event) => {(event.currentTarget as HTMLImageElement).src = `${basePath}default.png`; return false;}} alt="user avatar" width="80" height="80" />
|
||||
<div id="name" class=" relative flex flex-row items-center text-text-muted-dark justify-center gap-4 w-1/2">
|
||||
<button onclick={() => changeUser(0)}
|
||||
class=" active:-translate-x-0.5 hover:text-primary-hover-dark"><ChevronLeft size={16} strokeWidth={2} /></button>
|
||||
<strong id="username" class=" mx-auto" onanimationend={(event) => {event.currentTarget.innerText = username; event.currentTarget.classList.remove('switchR', 'switchL');}}>gornodox</strong>
|
||||
<strong bind:this={elem} class=" mx-auto">{username}</strong>
|
||||
<button onclick={() => changeUser(1)}
|
||||
class=" active:translate-x-0.5 hover:text-primary-hover-dark"><ChevronRight size={16} strokeWidth={2} /></button>
|
||||
</div>
|
||||
@@ -70,11 +61,11 @@
|
||||
}
|
||||
|
||||
.switchL {
|
||||
animation: fadeSlideLeft 1s forwards cubic-bezier(.4,.7,0,.99);
|
||||
animation: fadeSlideLeft .75s forwards cubic-bezier(.4,.7,0,.99);
|
||||
}
|
||||
|
||||
.switchR {
|
||||
animation: fadeSlideRight 1s forwards cubic-bezier(.4,.7,0,.99);
|
||||
animation: fadeSlideRight .75s forwards cubic-bezier(.4,.7,0,.99);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user