Factor out AnimatableTile{Factory}
This commit is contained in:
@@ -1,19 +1,9 @@
|
||||
import { Tile } from './tile.js';
|
||||
export class SimpleTile extends Tile {
|
||||
import { AnimatableTile } from './animatable_tile.js';
|
||||
export class SimpleTile extends AnimatableTile {
|
||||
constructor(width, height, image_url, animations) {
|
||||
super(width, height);
|
||||
super(width, height, animations);
|
||||
this.elem.style.backgroundImage = `url('${encodeURIComponent(image_url)}')`;
|
||||
this.elem.style.backgroundSize = 'cover';
|
||||
this.animations = animations;
|
||||
}
|
||||
play(name) {
|
||||
const animation = this.animations.get(name);
|
||||
if (animation) {
|
||||
return this.elem.animate(...animation);
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=simple_tile.js.map
|
||||
Reference in New Issue
Block a user