Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Component({
- selector: '[wmAnimate]',
- template: '<ng-content></ng-content>',
- animations: $animations
- })
- export class AnimateComponent implements OnInit, OnDestroy {
- readonly timings = { slower: '3s', slow: '2s', normal: '1s', fast: '500ms', faster: '300ms' };
- constructor(private elm: ElementRef, private scroll: ScrollDispatcher, private zone: NgZone) {}
- /** Selects the animation to be played */
- @Input('wmAnimate') animate: wmAnimations;
- /** Speeds up or slows down the animation */
- @Input() speed: wmAnimateSpeed = 'normal';
- /** When true, triggers the animation on element scrolling in the viewport */
- @Input('aos') set enableAOS(value: boolean) { this.aos = coerceBooleanProperty(value); }
- public aos: boolean = false;
- /** Specifies the amout of visibility triggering AOS */
- @Input() threshold: number = 0.2;
- ngOnInit() {
- // Triggers the animation based on the input flags
- this.animateTrigger(this.elm).subscribe( trigger => {
- // Triggers the animation to play or to idle
- this.trigger = trigger ? this.play : this.idle;
- });
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement