diff --git a/src/lib/components/navbar.svelte b/src/lib/components/navbar.svelte
index f194673..a0e1e2d 100644
--- a/src/lib/components/navbar.svelte
+++ b/src/lib/components/navbar.svelte
@@ -15,7 +15,6 @@
let cursorX;
let cursorY;
- let navbar_title;
let navbar_category;
function isActive(str, url) {
@@ -73,15 +72,6 @@
class={scrollY < SCROLL
? "disabled"
: "navbar-height flex-row container"}
- on:mousemove={(event) => {
- update_gradient(event, navbar_title);
- }}
- on:mouseenter={() => {
- animateForeground(true, navbar_title);
- }}
- on:mouseleave={() => {
- animateForeground(false, navbar_title);
- }}
>
Etheryo
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 4695358..f07a350 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -8,6 +8,7 @@
import Git from "$lib/components/git.svelte";
import HoverCard from "$lib/components/hover-card.svelte";
+ import anime from "animejs";
import topics from "$lib/ts/topic.ts";
import { filterPhotos } from "$lib/ts/photo.ts";
@@ -16,23 +17,36 @@
let photoList = filterPhotos(hubjson.photos);
$: index = 0;
+ let photoDiv;
+ let tempPhotoDiv;
- function swipeCanva(event, canva) {
- const id = index;
+ function updateIndex(advance) {
+ if (advance && index < photoList.length - 1) {
+ index++;
+ } else if (!advance && index >= 1) {
+ index--;
+ }
+ }
+
+ function swipeCanva(advance) {
const width = window.innerWidth / 2;
- const animTranslate = active > id ? [width, -width] : [-width, width];
+ const animTranslate = advance ? [-width, width] : [width, -width];
+
+ // Checking if we can play the animation
+ if (!((advance && index < photoList.length - 1) || (!advance && index >= 1)))
+ return;
anime({
- targets: pageDiv,
+ targets: photoDiv,
translateX: animTranslate[0],
opacity: 0,
duration: 300,
easing: "easeInQuad",
complete: function () {
- active = id;
- pageDiv.style.transform = `translateX(${animTranslate[1]}px)`;
+ updateIndex(advance);
+ photoDiv.style.transform = `translateX(${animTranslate[1]}px)`;
anime({
- targets: pageDiv,
+ targets: photoDiv,
translateX: 0,
opacity: 1,
duration: 300,
@@ -94,7 +108,7 @@
{hubjson.photo.title}
{hubjson.photo.description}
-