Refactor: Visual update

This commit is contained in:
Donatas Kirda 2024-05-16 18:42:09 +03:00
parent 0cfe495a11
commit 33c7c30de3
Signed by: bloodwiing
GPG Key ID: 63020D8D3F4A164F
11 changed files with 66 additions and 18 deletions

View File

@ -93,7 +93,7 @@
<div class="nameField"> <div class="nameField">
<Mention user={comment.author}></Mention> <Mention user={comment.author}></Mention>
{#each tags as tag} {#each tags as tag}
<span class="tag typeTitle">{tag}</span> <span class="tag typeHead">{tag}</span>
{/each} {/each}
{#if replyTo} {#if replyTo}

View File

@ -59,7 +59,7 @@
<form class="entryForm" {action} {method} on:submit={(e) => {dispatch('submit', e);}} {...$$restProps}> <form class="entryForm" {action} {method} on:submit={(e) => {dispatch('submit', e);}} {...$$restProps}>
<div class="name"> <div class="name">
<h1 class="typeHead noSelect">{formName}</h1> <h1 class="typeDisplay noSelect">{formName}</h1>
<slot name="belowName" /> <slot name="belowName" />
</div> </div>

View File

@ -128,7 +128,7 @@
<Mention user={post.author}></Mention> <Mention user={post.author}></Mention>
<Ago date={post.postDate}></Ago> <Ago date={post.postDate}></Ago>
</div> </div>
<h1 class="typeTitle title">{post.name}</h1> <h1 class="typeHead title">{post.name}</h1>
</div> </div>
</div> </div>

View File

@ -1,8 +1,8 @@
import { getCategories } from "$lib/server/db/category"; import { getCategories } from "$lib/server/db/category";
/** @type {import("@sveltejs/kit").ServerLoad} */ /** @type {import("@sveltejs/kit").ServerLoad} */
export async function load({ locals }) { export async function load() {
const categories = await getCategories(locals.sql); const categories = await getCategories();
return { return {
categories: categories categories: categories

View File

@ -1,10 +1,20 @@
<script> <script>
import { onMount } from "svelte";
/** @type {Element} */ /** @type {Element} */
let glow1; let glow1;
/** @type {Element} */ /** @type {Element} */
let background; let background;
/** @typedef {{x: number, y: number, size: number}} glowAnimState */
/** @type {glowAnimState} */
let current = {x: 0, y: 0, size: 100};
/** @type {glowAnimState} */
let target = {x: 0, y: 0, size: 100};
const speed = 0.003;
function mouseMoveGlow(/** @type {MouseEvent | TouchEvent} */ e) { function mouseMoveGlow(/** @type {MouseEvent | TouchEvent} */ e) {
const rect = background.getBoundingClientRect(); const rect = background.getBoundingClientRect();
@ -16,8 +26,46 @@
const size = (Math.max(Math.abs(x - 0.5), Math.abs(y - 0.5)) * 2) * 10 + 100; const size = (Math.max(Math.abs(x - 0.5), Math.abs(y - 0.5)) * 2) * 10 + 100;
glow1.setAttribute('style', `--x: ${x * 100}%; --y: ${y * 100}%; --size: ${size}%;`); target = {x: x * 100, y: y * 100, size: size};
} }
/** @type {number} */
let prevTimeStamp = -1;
function follow(/** @type {number} */ timeStamp) {
if (prevTimeStamp == -1) {
prevTimeStamp = timeStamp;
requestAnimationFrame(follow);
return;
}
/** @type {glowAnimState} */
const vector = {
x: target.x - current.x,
y: target.y - current.y,
size: target.size - current.size,
};
const delta = Math.min((timeStamp - prevTimeStamp) * speed, 1.0);
current = {
x: current.x + vector.x * delta,
y: current.y + vector.y * delta,
size: current.size + vector.size * delta,
};
glow1.setAttribute('style', `--x: ${current.x}%; --y: ${current.y}%; --size: ${current.size}%;`);
prevTimeStamp = timeStamp;
requestAnimationFrame(follow);
// setTimeout(() => {
// }, 300);
}
onMount(() => {
window.requestAnimationFrame(follow);
});
</script> </script>
<style lang="scss"> <style lang="scss">
@ -99,7 +147,6 @@
background-size: var(--size) var(--size); background-size: var(--size) var(--size);
mix-blend-mode: color-dodge; mix-blend-mode: color-dodge;
transition: 0.5s ease-out;
} }
&#glow-2 { &#glow-2 {

View File

@ -6,6 +6,6 @@
<Entryform action="/login" formName="Login" submitText="enter"> <Entryform action="/login" formName="Login" submitText="enter">
<a href="/register" slot="belowName">New here?</a> <a href="/register" slot="belowName">New here?</a>
<Entryfield name="username" labelName="Username" type="text" autocomplete="username"></Entryfield> <Entryfield name="username" labelName="username" type="text" autocomplete="username"></Entryfield>
<Entryfield name="password" labelName="Password" type="password" autocomplete="current-password"></Entryfield> <Entryfield name="password" labelName="password" type="password" autocomplete="current-password"></Entryfield>
</Entryform> </Entryform>

View File

@ -18,7 +18,7 @@
<Entryform action="/register" formName="Register" submitText="go!" on:submit={(e) => {submitForm(e.detail);}}> <Entryform action="/register" formName="Register" submitText="go!" on:submit={(e) => {submitForm(e.detail);}}>
<a href="/login" slot="belowName">Already a member?</a> <a href="/login" slot="belowName">Already a member?</a>
<Entryfield name="username" labelName="Username" type="text" autocomplete="username"></Entryfield> <Entryfield name="username" labelName="username" type="text" autocomplete="username"></Entryfield>
<Entryfield name="password" labelName="Password" type="password" autocomplete="new-password" bind:value={password}></Entryfield> <Entryfield name="password" labelName="password" type="password" autocomplete="new-password" bind:value={password}></Entryfield>
<Entryfield name="repeatPassword" labelName="Confirm Password" type="password" autocomplete="new-password" bind:value={repeatPassword}></Entryfield> <Entryfield name="repeatPassword" labelName="confirm password" type="password" autocomplete="new-password" bind:value={repeatPassword}></Entryfield>
</Entryform> </Entryform>

View File

@ -22,6 +22,6 @@
</style> </style>
<div class="center"> <div class="center">
<h1 class="typeHead"><span class="typeContent">Welcome to </span>Echo</h1> <h1 class="typeDisplay"><span class="typeContent">Welcome to </span>Echo</h1>
<p>Currently suppored link: <a href="/posts">/posts</a></p> <p>Currently suppored link: <a href="/posts">/posts</a></p>
</div> </div>

View File

@ -3,7 +3,7 @@
--background: #111118; --background: #111118;
--accent-gray: #8298b1; --accent-gray: #b182a3;
--accent-light: #9e8afa; --accent-light: #9e8afa;
--accent: #846bf7; --accent: #846bf7;

View File

@ -11,7 +11,7 @@
} }
.lt-afficher-neue-400, .lt-afficher-neue-400,
.typeTitle { .typeHead {
font-family: "LT Afficher Neue", serif; font-family: "LT Afficher Neue", serif;
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
@ -47,7 +47,8 @@
font-style: normal; font-style: normal;
} }
.taviraj-light { .taviraj-light,
.typeTitle {
font-family: "Taviraj", serif; font-family: "Taviraj", serif;
font-weight: 300; font-weight: 300;
font-style: normal; font-style: normal;
@ -168,7 +169,7 @@
} }
.cinzel-decorative-regular, .cinzel-decorative-regular,
.typeHead { .typeDisplay {
font-family: "Cinzel Decorative", serif; font-family: "Cinzel Decorative", serif;
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;

View File

@ -7,7 +7,7 @@ form.entryForm {
padding: 32px; padding: 32px;
background: #00000090; background: #00000090;
border-radius: 16px; border-radius: 16px;
/* backdrop-filter: blur(28px); */ backdrop-filter: blur(16px);
max-width: 350px; max-width: 350px;
width: calc(20dvw + 150px); width: calc(20dvw + 150px);