Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. @Component({
  2. selector: '[wmAnimate]',
  3. template: '<ng-content></ng-content>',
  4. animations: $animations
  5. })
  6. export class AnimateComponent implements OnInit, OnDestroy {
  7.  
  8. readonly timings = { slower: '3s', slow: '2s', normal: '1s', fast: '500ms', faster: '300ms' };
  9.  
  10. constructor(private elm: ElementRef, private scroll: ScrollDispatcher, private zone: NgZone) {}
  11.  
  12. /** Selects the animation to be played */
  13. @Input('wmAnimate') animate: wmAnimations;
  14.  
  15. /** Speeds up or slows down the animation */
  16. @Input() speed: wmAnimateSpeed = 'normal';
  17.  
  18. /** When true, triggers the animation on element scrolling in the viewport */
  19. @Input('aos') set enableAOS(value: boolean) { this.aos = coerceBooleanProperty(value); }
  20. public aos: boolean = false;
  21.  
  22. /** Specifies the amout of visibility triggering AOS */
  23. @Input() threshold: number = 0.2;
  24.  
  25. ngOnInit() {
  26.  
  27. // Triggers the animation based on the input flags
  28. this.animateTrigger(this.elm).subscribe( trigger => {
  29. // Triggers the animation to play or to idle
  30. this.trigger = trigger ? this.play : this.idle;
  31. });
  32. }
  33. ...
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement