Index: Added chunk splitter for photo canvas.
This commit is contained in:
parent
12d2a0a040
commit
3a67ee23b8
4 changed files with 70 additions and 10 deletions
|
@ -13,7 +13,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleKeyDown(event, url) {
|
function handleKeyDown(event, url) {
|
||||||
console.log(event);
|
|
||||||
if (event.key === "Enter" || event.key === " ") {
|
if (event.key === "Enter" || event.key === " ") {
|
||||||
redirectTo(url);
|
redirectTo(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
{
|
{
|
||||||
"welcomeTitle": "Bienvenue sur Etheryo",
|
"welcomeTitle": "Bienvenue sur Etheryo",
|
||||||
"welcomeSubtitle": "'Etheryo' provient du mot 'Éther'/'Æther' dans la mythologie grec ainsi que de mon propre prénom. Le but de ce site web est de montrer mes créations. Qu'elles soient artistiques, philosophiques ou scientifiques, elles reflettent tout ce que je veux apporter au monde.",
|
"welcomeSubtitle": "'Etheryo' provient du mot 'Éther'/'Æther' dans la mythologie grec ainsi que de mon propre prénom. Le but de ce site web est de montrer mes créations. Qu'elles soient artistiques, philosophiques ou scientifiques, elles reflettent tout ce que je veux apporter au monde.",
|
||||||
|
"cover": "https://share.etheryo.fr/rando/2024.07.28/IMG20240728141949_min.jpg",
|
||||||
"who": "Qui suis-je ?",
|
"who": "Qui suis-je ?",
|
||||||
"person": {
|
"person": {
|
||||||
"name": "Yohan Boujon",
|
"name": "Yohan Boujon",
|
||||||
"pronouns": "il/lui",
|
"pronouns": "il/lui",
|
||||||
|
"picture": "https://share.etheryo.fr/personal/yohan/pfp.jpg",
|
||||||
"description": "Informatics and electronics engineer",
|
"description": "Informatics and electronics engineer",
|
||||||
"knowme": "Me Connaître"
|
"knowme": "Me Connaître"
|
||||||
},
|
},
|
||||||
|
@ -53,14 +55,14 @@
|
||||||
"urlcompressed": "https://cloud.etheryo.fr/s/azb63ct3bGn84Da/download?path=&files=IMG20240728150532_compressed.jpg",
|
"urlcompressed": "https://cloud.etheryo.fr/s/azb63ct3bGn84Da/download?path=&files=IMG20240728150532_compressed.jpg",
|
||||||
"url": "https://share.etheryo.fr/rando/2024.07.28/IMG20240728150532.jpg",
|
"url": "https://share.etheryo.fr/rando/2024.07.28/IMG20240728150532.jpg",
|
||||||
"title": "Tarnished Peak (afterwar)",
|
"title": "Tarnished Peak (afterwar)",
|
||||||
"localisation": "Ben More, Écosse",
|
"localisation": "Cruach Adrain, Écosse",
|
||||||
"description": "L'appel à l'aventure était trop fort. Je ne voulais plus m'arrêter, mais comme à mon habitude, mon corps ne pouvait suivre mes pensées. Je me suis posé pendant plusieurs minutes devant cette falaise, me demandant ce qu'il y'avait derrière. Les nuages flottants et changeant de place à la vitesse du vent était un reflet de mes émotions qui changeaient."
|
"description": "L'appel à l'aventure était trop fort. Je ne voulais plus m'arrêter, mais comme à mon habitude, mon corps ne pouvait suivre mes pensées. Je me suis posé pendant plusieurs minutes devant cette falaise, me demandant ce qu'il y'avait derrière. Les nuages flottants et changeant de place à la vitesse du vent était un reflet de mes émotions qui changeaient."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"urlcompressed": "https://cloud.etheryo.fr/s/azb63ct3bGn84Da/download?path=&files=IMG20240728142327_compressed.jpg",
|
"urlcompressed": "https://cloud.etheryo.fr/s/azb63ct3bGn84Da/download?path=&files=IMG20240728142327_compressed.jpg",
|
||||||
"url": "https://share.etheryo.fr/rando/2024.07.28/IMG20240728142327.jpg",
|
"url": "https://share.etheryo.fr/rando/2024.07.28/IMG20240728142327.jpg",
|
||||||
"title": "Whitewashed",
|
"title": "Whitewashed",
|
||||||
"localisation": "Ben More, Écosse",
|
"localisation": "Cruach Adrain, Écosse",
|
||||||
"description": "Photo modifiée pour ajouter cet effet de brume lointaine. Le ciel était bien bleu mais les nuages cachaient cette lumière et laissait paraître une ambiance blanchâtre."
|
"description": "Photo modifiée pour ajouter cet effet de brume lointaine. Le ciel était bien bleu mais les nuages cachaient cette lumière et laissait paraître une ambiance blanchâtre."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -69,7 +71,13 @@
|
||||||
"title": "Compagnons",
|
"title": "Compagnons",
|
||||||
"localisation": "Lac d'Oô, France",
|
"localisation": "Lac d'Oô, France",
|
||||||
"description": "Lors de notre petit periple avec quelques camarades de l'INSA nous avons décidé de nous balader vers l'autre bout du lac. Cette photo est une prise de vue de loin par ma part de mes camarades, observant leurs divers déplacements devant le coucher du soleil."
|
"description": "Lors de notre petit periple avec quelques camarades de l'INSA nous avons décidé de nous balader vers l'autre bout du lac. Cette photo est une prise de vue de loin par ma part de mes camarades, observant leurs divers déplacements devant le coucher du soleil."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"urlcompressed": "https://cloud.etheryo.fr/s/azb63ct3bGn84Da/download?path=&files=IMG20240728155726_compressed.jpg",
|
||||||
|
"url": "https://share.etheryo.fr/rando/2024.07.28/IMG20240728155726.jpg",
|
||||||
|
"title": "Replica",
|
||||||
|
"localisation": "Cruach Adrain, Écosse",
|
||||||
|
"description": "'Replca' ou 'Replique' montre la nature fractale des collines écossaises."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
15
src/lib/ts/photo.ts
Normal file
15
src/lib/ts/photo.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
type Photo = {
|
||||||
|
urlcompressed: string;
|
||||||
|
url: string;
|
||||||
|
title: string;
|
||||||
|
localisation: string,
|
||||||
|
description: string,
|
||||||
|
};
|
||||||
|
|
||||||
|
export function filterPhotos(photos: Photo[], chunkSize = 3): Photo[][] {
|
||||||
|
const chunks: Photo[][] = [];
|
||||||
|
for (let i = 0; i < photos.length; i += chunkSize) {
|
||||||
|
chunks.push(photos.slice(i, i + chunkSize));
|
||||||
|
}
|
||||||
|
return chunks;
|
||||||
|
}
|
|
@ -9,17 +9,43 @@
|
||||||
import HoverCard from "$lib/components/hover-card.svelte";
|
import HoverCard from "$lib/components/hover-card.svelte";
|
||||||
|
|
||||||
import topics from "$lib/ts/topic.ts";
|
import topics from "$lib/ts/topic.ts";
|
||||||
|
import { filterPhotos } from "$lib/ts/photo.ts";
|
||||||
|
|
||||||
import hubjson from "$lib/json/hub.json";
|
import hubjson from "$lib/json/hub.json";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
let hub_cover =
|
let photoList = filterPhotos(hubjson.photos);
|
||||||
"https://share.etheryo.fr/rando/2024.07.28/IMG20240728141949_min.jpg";
|
$: index = 0;
|
||||||
let profile_pic = "https://share.etheryo.fr/personal/yohan/pfp.jpg";
|
|
||||||
|
function swipeCanva(event, canva) {
|
||||||
|
const id = index;
|
||||||
|
const width = window.innerWidth / 2;
|
||||||
|
const animTranslate = active > id ? [width, -width] : [-width, width];
|
||||||
|
|
||||||
|
anime({
|
||||||
|
targets: pageDiv,
|
||||||
|
translateX: animTranslate[0],
|
||||||
|
opacity: 0,
|
||||||
|
duration: 300,
|
||||||
|
easing: "easeInQuad",
|
||||||
|
complete: function () {
|
||||||
|
active = id;
|
||||||
|
pageDiv.style.transform = `translateX(${animTranslate[1]}px)`;
|
||||||
|
anime({
|
||||||
|
targets: pageDiv,
|
||||||
|
translateX: 0,
|
||||||
|
opacity: 1,
|
||||||
|
duration: 300,
|
||||||
|
easing: "easeOutQuad",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="main-banner">
|
<div class="main-banner">
|
||||||
<CoverImg
|
<CoverImg
|
||||||
cover={hub_cover}
|
cover={hubjson.cover}
|
||||||
darken={true}
|
darken={true}
|
||||||
title={hubjson.welcomeTitle}
|
title={hubjson.welcomeTitle}
|
||||||
subtitle={hubjson.welcomeSubtitle}
|
subtitle={hubjson.welcomeSubtitle}
|
||||||
|
@ -32,7 +58,7 @@
|
||||||
<div class="flex w-100 justify-center">
|
<div class="flex w-100 justify-center">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<Person
|
<Person
|
||||||
picture={profile_pic}
|
picture={hubjson.person.picture}
|
||||||
name={hubjson.person.name}
|
name={hubjson.person.name}
|
||||||
pronouns={hubjson.person.pronouns}
|
pronouns={hubjson.person.pronouns}
|
||||||
description={hubjson.person.description}
|
description={hubjson.person.description}
|
||||||
|
@ -69,7 +95,7 @@
|
||||||
<p>{hubjson.photo.description}</p>
|
<p>{hubjson.photo.description}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex w-100 justify-center">
|
<div class="flex w-100 justify-center">
|
||||||
{#each hubjson.photos as photo}
|
{#each photoList[index] as photo}
|
||||||
<HoverCard
|
<HoverCard
|
||||||
picture={photo.urlcompressed}
|
picture={photo.urlcompressed}
|
||||||
picturefull={photo.url}
|
picturefull={photo.url}
|
||||||
|
@ -79,4 +105,16 @@
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
if (index >= 1) index--;
|
||||||
|
|
||||||
|
|
||||||
|
}}><</button
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
if (index < photoList.length - 1) index++;
|
||||||
|
}}>></button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue