mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
69 lines
1.2 KiB
JavaScript
69 lines
1.2 KiB
JavaScript
import {Component, Decorator, View as NgView, NgElement, bootstrap} from 'angular2/angular2';
|
|
import {Animation} from 'ionic/ionic';
|
|
|
|
|
|
|
|
@Component({ selector: '[ion-app]' })
|
|
@NgView({
|
|
templateUrl: 'main.html'
|
|
})
|
|
class IonicApp {
|
|
constructor() {
|
|
|
|
|
|
}
|
|
|
|
fadeOut() {
|
|
let animation = new Animation();
|
|
animation.elements( document.querySelectorAll('.square') );
|
|
animation.debug(2);
|
|
|
|
animation.duration(500);
|
|
animation.easing('swing');
|
|
|
|
animation.property('opacity', 0);
|
|
|
|
let q = animation.start();
|
|
|
|
q.then(()=> {
|
|
console.log('fade out complete')
|
|
});
|
|
}
|
|
|
|
fadeIn() {
|
|
let animation = new Animation();
|
|
animation.elements( document.querySelectorAll('.square') );
|
|
animation.debug(2);
|
|
|
|
animation.duration(500);
|
|
animation.easing('swing');
|
|
|
|
animation.property('opacity', 1);
|
|
|
|
let q = animation.start();
|
|
|
|
q.then(()=> {
|
|
console.log('fade in complete')
|
|
});
|
|
}
|
|
|
|
percent(ev) {
|
|
let ratio = parseFloat(ev.srcElement.value) / 100;
|
|
console.log('percent ratio', ratio);
|
|
|
|
this.animation.percent(ratio);
|
|
}
|
|
|
|
stop() {
|
|
this.animation.stop();
|
|
}
|
|
|
|
velocityStart() {
|
|
window.Velocity(document.querySelectorAll('.square'), { opacity: 0 }, 500);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
bootstrap(IonicApp)
|