mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
83 lines
1.6 KiB
JavaScript
83 lines
1.6 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() {
|
|
this.animation = new Animation();
|
|
this.animation.elements( document.querySelectorAll('.square') );
|
|
this.animation.debug(2);
|
|
|
|
this.animation.duration(500);
|
|
this.animation.easing('swing');
|
|
|
|
this.animation.property('opacity', 0);
|
|
this.animation.property('translateX', '100px');
|
|
|
|
let q = this.animation.start();
|
|
|
|
q.then(()=> {
|
|
console.log('fade out complete')
|
|
});
|
|
}
|
|
|
|
fadeIn() {
|
|
this.animation = new Animation();
|
|
this.animation.elements( document.querySelectorAll('.square') );
|
|
this.animation.debug(2);
|
|
|
|
this.animation.duration(2500);
|
|
this.animation.easing('swing');
|
|
|
|
this.animation.property('opacity', 1);
|
|
this.animation.property('translateX', '0px');
|
|
|
|
let q = this.animation.start();
|
|
|
|
q.then(()=> {
|
|
console.log('fade in complete')
|
|
});
|
|
}
|
|
|
|
stop() {
|
|
this.animation.stop();
|
|
}
|
|
|
|
percent(ev) {
|
|
let ratio = parseFloat(ev.srcElement.value) / 100;
|
|
console.log('percent ratio', ratio);
|
|
|
|
this.animation.percent(ratio);
|
|
}
|
|
|
|
stop() {
|
|
this.animation.stop();
|
|
}
|
|
|
|
velocityStart() {
|
|
var elements = document.querySelectorAll('.square');
|
|
Velocity(elements, {
|
|
opacity: 0,
|
|
translateX: '100px'
|
|
}, 5000);
|
|
|
|
setTimeout(function() {
|
|
Velocity(elements, "stop");
|
|
}, 1000)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
bootstrap(IonicApp)
|