builtin animations

This commit is contained in:
Adam Bradley
2015-05-29 16:20:33 -05:00
parent 42bcdafac8
commit 0db02f0633
4 changed files with 38 additions and 11 deletions

View File

@ -1,6 +1,8 @@
import * as util from 'ionic/util/util';
let registry = {};
export class Animation {
constructor(el) {
@ -26,7 +28,7 @@ export class Animation {
elements(el) {
if (el) {
if (typeof el === 'string') {
el = document.querySelectorAll(ele);
el = document.querySelectorAll(el);
}
if (el.length) {
@ -280,6 +282,21 @@ export class Animation {
this._el = this._parent = this._children = this._players = null;
}
/*
STATIC CLASSES
*/
static create(element, name) {
let AnimationClass = registry[name];
if (!AnimationClass) {
AnimationClass = Animation;
}
return new AnimationClass(element);
}
static register(name, AnimationClass) {
registry[name] = AnimationClass;
}
}
class Animate {