diff --git a/apps/angular/46-simple-animations/src/app/app.component.ts b/apps/angular/46-simple-animations/src/app/app.component.ts index ae63db419..30446142d 100644 --- a/apps/angular/46-simple-animations/src/app/app.component.ts +++ b/apps/angular/46-simple-animations/src/app/app.component.ts @@ -1,8 +1,49 @@ +import { + animate, + query, + stagger, + style, + transition, + trigger, +} from '@angular/animations'; import { Component } from '@angular/core'; @Component({ - imports: [], + imports: [ + // BrowserAnimationsModule + ], selector: 'app-root', + animations: [ + trigger('fadeIn', [ + transition(':enter', [ + style({ + transform: 'translateX(-20%)', + opacity: 0, + }), + animate( + '500ms', + style({ + opacity: 1, + transform: 'translateX(0%)', + }), + ), + ]), + ]), + + trigger('stagger', [ + transition(':enter', [ + query('.list-item', [ + style({ transform: 'translateX(-10%)', opacity: 0 }), + stagger(100, [ + animate( + '200ms linear', + style({ opacity: 1, transform: 'translateX(0)' }), + ), + ]), + ]), + ]), + ]), + ], styles: ` section { @apply flex flex-1 flex-col gap-5; @@ -18,7 +59,7 @@ import { Component } from '@angular/core'; `, template: `
@@ -50,7 +91,7 @@ import { Component } from '@angular/core';