From fc9c72b6b3cc7ad7d9baba7bcc398080e5c0e6b7 Mon Sep 17 00:00:00 2001 From: Me Date: Wed, 30 Nov 2022 22:42:43 +0100 Subject: [PATCH] well i finally got the glittery stars animation to work for the ProfileDisplay page, cool --- .../api_front/src/ProfileDisplay.svelte | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/srcs/requirements/svelte/api_front/src/ProfileDisplay.svelte b/srcs/requirements/svelte/api_front/src/ProfileDisplay.svelte index 4561572a..035a1e7a 100644 --- a/srcs/requirements/svelte/api_front/src/ProfileDisplay.svelte +++ b/srcs/requirements/svelte/api_front/src/ProfileDisplay.svelte @@ -2,9 +2,7 @@ import { onMount } from 'svelte'; - import {location} from 'svelte-spa-router'; - // this could be how i - + import { location } from 'svelte-spa-router'; // this is how you access /:first for example // export let params = {} //

Your name is: {params.first} {#if params.last}{params.last}{/if}

@@ -24,6 +22,9 @@ let user; let rank = ''; + + // i think i don't need to do this once i sort out the {wrap} conditions: in theory i could pass values to the Route + // once the async authentication check is done onMount( async() => { user = await fetch('http://transcendance:8080/api/v2/user') .then( (x) => x.json() ); @@ -54,43 +55,39 @@ star.style.animation = ""; } - // for(const star of document.getElementsByClassName("glitter-star")) { - // setTimeout(() => { - // animate(star); + // This is the part i invented, it was kinda a fucking nightmare... + let stars = []; + + for (let i = 0; i < 3; i++) { + setTimeout(() => { + animate(stars[i]); - // setInterval(() => animate(star), 1000); - // }, index++ * (interval / 3)) - // } - - - + setInterval(() => animate(stars[i]), 1000); + }, index++ * (interval / 3)) + } - - {#if user !== undefined}
- -
{user.image_url}
default user icon
{user.username}
Rank: - + - + - + @@ -117,12 +114,8 @@ text-align: center; } - main.offset{ - grid-column: 3 / span 10; - } - /* Normal CSS stuff */ -.icon{ + .icon{ max-width: 150px; } @@ -149,6 +142,10 @@ font-weight: bold; } + + /* Glittery Star Stuff */ + + :root { --purple: rgb(123, 31, 162); --violet: rgb(103, 58, 183); @@ -237,6 +234,4 @@ white-space: nowrap; } - - \ No newline at end of file