From 391c9d5860a6895d203d66378e358c8eed0e7306 Mon Sep 17 00:00:00 2001 From: Carpenteri1 Date: Sat, 13 Apr 2024 14:12:10 +0200 Subject: [PATCH] state and trigger changes --- .../carouselcomponent/carousel.component.css | 56 ------------------- .../carouselcomponent/carousel.component.html | 26 +++++---- .../carouselcomponent/carousel.component.ts | 38 +++++++++---- 3 files changed, 41 insertions(+), 79 deletions(-) diff --git a/src/app/component/carouselcomponent/carousel.component.css b/src/app/component/carouselcomponent/carousel.component.css index cc566a5..89b2d33 100644 --- a/src/app/component/carouselcomponent/carousel.component.css +++ b/src/app/component/carouselcomponent/carousel.component.css @@ -76,59 +76,3 @@ border-radius: 2px; } } -/* -@media only screen and (max-width: 835px), -screen and (max-height: 520px) { - .setspace{ - padding:0; - } -} - -@media only screen and (max-width: 767px), -screen and (max-height: 655px) { - .progress{ - height: 1.2em; - width: 85%; - } -} - -@media only screen and (max-width: 575px){ - p{ - font-size:0.7em; - } - .progress{ - width: 100%; - margin-top: -1.5em; - } - .col-sm-4 p{ - text-align: center; - } - -} - -@media only screen and (min-height: 420px ){ - .setspace{ - padding:0; - } - .progress{ - height: 2em !important; - } -} - - -@media only screen and (max-width: 420px), -screen and (max-height: 535px) { - .progress{ - height: 1em; - } -} - -@media only screen and (max-width: 250px), -screen and (max-height: 450px) { - p{ - font-size:0.6em; - } - .progress{ - height: 0.8em; - } -}*/ \ No newline at end of file diff --git a/src/app/component/carouselcomponent/carousel.component.html b/src/app/component/carouselcomponent/carousel.component.html index b4fd0f1..07d230f 100644 --- a/src/app/component/carouselcomponent/carousel.component.html +++ b/src/app/component/carouselcomponent/carousel.component.html @@ -1,25 +1,27 @@ -
-
-

{{title}}

-
+
-
-
-
-
-
-
{{item.name}}
-
+
+
+

{{title}}

+
+
+
+
+
+
+
{{item.name}}
+
+
-
+
diff --git a/src/app/component/carouselcomponent/carousel.component.ts b/src/app/component/carouselcomponent/carousel.component.ts index eb839b7..183b03e 100644 --- a/src/app/component/carouselcomponent/carousel.component.ts +++ b/src/app/component/carouselcomponent/carousel.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from "@angular/core"; -import { transition, style, animate, trigger, AnimationEvent } from '@angular/animations'; +import { transition, style, animate, trigger, AnimationEvent, state } from '@angular/animations'; import { ISkill } from "src/app/Interfaces/ISkill"; import { StringHandler } from "src/app/Utility/stringhandler"; @Component({ @@ -8,13 +8,16 @@ import { StringHandler } from "src/app/Utility/stringhandler"; styleUrls: ['carousel.component.css'], animations: [ trigger('fadeOut', [ - transition(':leave', [ - animate('2000ms', style({ opacity: 0 })) + state('fadeIn', style({ opacity: 1 })), + state('fadeOut', style({ opacity: 0 })), + transition('fadeIn <=> fadeOut', [ + animate('2000ms') ]) ]), trigger('fadeIn', [ - transition(':enter', [ - style({ opacity: 0 }), + state('fadeOut', style({ opacity: 0 })), + state('fadeIn', style({ opacity: 1 })), + transition('fadeOut <=> fadeIn', [ animate('2000ms', style({ opacity: 1 })) ]) ]) @@ -25,7 +28,8 @@ export class CarouselComponent implements OnInit { readonly title: string = StringHandler.carouselTitle; private interval: number = 8000; - fadeIn = false; + fadeIn = true; + fadeOut = false; private intervalId: any; @@ -81,6 +85,11 @@ export class CarouselComponent implements OnInit { this.setMessage(); } + fadeOutDone2() { + this.index++; + this.setMessage(); + } + setMessage() { if (this.index <= 2 && @@ -121,12 +130,19 @@ export class CarouselComponent implements OnInit { this.carouselTime(this.interval); } - fadeOutDone(event: AnimationEvent) { - if(event.toState === 'void'){ - this.fadeIn = true; + fadeOutDone(event: AnimationEvent) {//TODO dont seem to change state. + + if (event.fromState === 'void'){ + console.log(event); + event.fromState = 'fadeIn'; + event.toState = 'fadeOut'; + this.fadeOut = true; } - else{ - this.fadeIn = false; + if (event.fromState === 'fadeOut'){ + console.log(event); + event.fromState = 'fadeOut'; + event.toState = 'fadeIn'; + this.fadeOut = true; } }