Skip to content

Instantly share code, notes, and snippets.

@McQuinTrix
Last active September 21, 2018 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McQuinTrix/3bd041a4ffefc53633d38d927c782db7 to your computer and use it in GitHub Desktop.
Save McQuinTrix/3bd041a4ffefc53633d38d927c782db7 to your computer and use it in GitHub Desktop.
Making Animations in Angular Reusable
import {animate, animateChild, query, stagger, style, transition, trigger} from "@angular/animations";
export class Animations {
public static fadeIn = trigger('fadeIn', [
transition(':enter', [
style({ opacity: '0', marginTop: '10px'}),
animate('.2s ease-in', style({ opacity: '1', marginTop: '0px' })),
]),
]);
public static stagger = trigger('stagger', [
transition(':enter', [
query(':enter', stagger('.2s', [animateChild()]),{ optional: true })
])
])
}
//Using in Component File
//
//import {Animations} from "../../../../shared/animations/basic-animations";
//
//@Component({
// selector: 'app-component',
// providers: [],
// templateUrl: './app.component.html',
// animations: [
// Animations.fadeIn,
// Animations.stagger
// ],
//})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment