Files
tower/ts/animatable_tile.ts

21 lines
574 B
TypeScript
Raw Permalink Normal View History

2021-05-17 04:26:18 +00:00
import { Mask } from './mask.js';
2021-05-11 05:28:20 +00:00
import { Tile } from './tile.js';
export abstract class AnimatableTile extends Tile {
animations: Map<string, [Keyframe[], object]>;
2021-05-17 04:26:18 +00:00
constructor(width: number, height: number, masks: Map<string, Mask>, animations: Map<string, [Keyframe[], object]>) {
super(width, height, masks);
2021-05-11 05:28:20 +00:00
this.animations = animations;
}
play(name: string): Animation | undefined {
const animation = this.animations.get(name);
if (animation) {
return this.elem.animate(...animation);
} else {
return undefined;
}
}
}