diff --git a/frontend/src/app/home/home.component.scss b/frontend/src/app/home/home.component.scss
index 87c53f0..316673c 100644
--- a/frontend/src/app/home/home.component.scss
+++ b/frontend/src/app/home/home.component.scss
@@ -216,10 +216,6 @@ main .container {
border-radius: 5px;
}
-.display > span {
- animation: fadein 1.5s;
-}
-
.display > span {
width: 700px;
height: 400px;
diff --git a/frontend/src/app/home/home.component.ts b/frontend/src/app/home/home.component.ts
index 8c0cdf1..386d113 100644
--- a/frontend/src/app/home/home.component.ts
+++ b/frontend/src/app/home/home.component.ts
@@ -21,6 +21,8 @@ export class HomeComponent implements OnInit {
];
private slideIndex = 0;
+ public carouselOpacity = 1;
+ public triggerAnimation = false;
ngOnInit(): void {
this.titleService.setTitle('Survival Minecraft Server on ' + ALTITUDE_VERSION + ' | Altitude Community');
@@ -44,14 +46,14 @@ export class HomeComponent implements OnInit {
public previousSlide(): void {
if (this.slideIndex > 0) {
- this.slideIndex--;
+ this.setSlide(this.slideIndex - 1);
} else {
- this.slideIndex = this.slides.length - 1;
+ this.setSlide(this.slides.length - 1);
}
}
public nextSlide(): void {
- this.slideIndex = (this.slideIndex + 1) % this.slides.length;
+ this.setSlide((this.slideIndex + 1) % this.slides.length);
}
public getSlideIndices(): number[] {
@@ -60,6 +62,22 @@ export class HomeComponent implements OnInit {
public setSlide(slide: number): void {
this.slideIndex = slide;
+ this.triggerAnimation = true
+ this.carouselOpacity = 0;
+
+ const startTime = Date.now();
+ const duration = 1500;
+
+ const animate = () => {
+ const elapsed = Date.now() - startTime;
+
+ this.carouselOpacity = Math.min(elapsed / duration, 1);
+
+ if (this.carouselOpacity < 1) {
+ requestAnimationFrame(animate);
+ }
+ };
+ requestAnimationFrame(animate);
}
public getDotClass(slide: number): string {