🎨 Frontend & UI

Angular Animations

Animation patterns used in the Gauzy UI.

Angular Animation Module

import { BrowserAnimationsModule } from "@angular/platform-browser/animations";

@NgModule({
  imports: [BrowserAnimationsModule],
})
export class AppModule {}

Common Animations

Fade In/Out

import { trigger, transition, style, animate } from "@angular/animations";

export const fadeInOut = trigger("fadeInOut", [
  transition(":enter", [
    style({ opacity: 0 }),
    animate("300ms ease-in", style({ opacity: 1 })),
  ]),
  transition(":leave", [animate("200ms ease-out", style({ opacity: 0 }))]),
]);

Slide In

export const slideIn = trigger("slideIn", [
  transition(":enter", [
    style({ transform: "translateX(-100%)" }),
    animate("300ms ease-out", style({ transform: "translateX(0)" })),
  ]),
]);

List Stagger

export const listAnimation = trigger("listAnimation", [
  transition("* => *", [
    query(
      ":enter",
      [
        style({ opacity: 0, transform: "translateY(-15px)" }),
        stagger("50ms", [
          animate(
            "300ms ease-out",
            style({ opacity: 1, transform: "translateY(0)" }),
          ),
        ]),
      ],
      { optional: true },
    ),
  ]),
]);

Usage in Components

@Component({
  animations: [fadeInOut, slideIn],
  template: `
    <div @fadeInOut *ngIf="isVisible">Content</div>
    <div @slideIn>Slides in on load</div>
  `,
})
export class MyComponent {}

Where Used

ComponentAnimation
SidebarSlide open/close
ModalsFade in/scale
NotificationsSlide in from top
Task board cardsDrag and drop ease
Data loadingSkeleton shimmer

Edit this page

Copyright © 2023-Present Ever Co. LTD.Docs by Sourcey