На самом деле вы можете легко использовать Animate.css в вашем приложении.Сначала вам нужно установить
npm install --save css-animator
После этого включить 'AnimationService, AnimatesDirective' в свой модуль приложения
import { AnimationService, AnimatesDirective } from 'css-animator';
включить AnimatesDirective в объявлениях
declarations: [
AnimatesDirective,
...,
и AnimationServiceв вашем провайдере
providers: [
AnimationService,
{provide: ErrorHandler, useClass: IonicErrorHandler}
Вам нужно связать Animate.css в вашем файле index.html
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
Вот простой код
import { Component, ViewChild } from '@angular/core';
import { NavController } from 'ionic-angular';
import { ModalController, NavParams } from 'ionic-angular';
import {ContactPage} from '../contact/contact';
import { AnimationService, AnimationBuilder } from 'css-animator';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild('myElement') myElem;
private animator: AnimationBuilder;
constructor(public navCtrl: NavController, public modalController: ModalController, animationService: AnimationService) {
this.animator = animationService.builder();
}
animateElem() {
this.animator.setType('bounceInUp').show(this.myElem.nativeElement);
}
}
<ion-header>
<ion-navbar>
<ion-title>Home</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<button ion-button (click)="animateElem()">Animate it!</button>
<ion-card #myElement>
<ion-card-header>My Animation Card</ion-card-header>
<ion-card-content>So much awesome content and animations. AMAZING!</ion-card-content>
</ion-card>
</ion-content>
здесь Я создал репозиторий Stabblitz для ссылки.Вы можете вызвать функцию в событии прокрутки.