diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2022-06-02 23:13:07 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2022-06-02 23:16:33 +0200 |
| commit | b4defa324a330217f0139f1240bcf53c0b1f996a (patch) | |
| tree | deabb94fd351b10d3d6b38d967424149536b3927 /src/Animation.ts | |
| parent | ef76266d1a61c02f1721efedc830fab12279d2b9 (diff) | |
| download | 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.gz 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.tar.zst 1942-b4defa324a330217f0139f1240bcf53c0b1f996a.zip | |
v1.0.0
Diffstat (limited to 'src/Animation.ts')
| -rw-r--r-- | src/Animation.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Animation.ts b/src/Animation.ts index 968a57d..9d49ec7 100644 --- a/src/Animation.ts +++ b/src/Animation.ts @@ -4,6 +4,7 @@ import Drawable from "./Drawable"; export default class Anime extends Drawable { i = 0; j = 0; + cb: any | null; constructor(public drawable: Drawable, public frames: Array<string | HTMLImageElement>) { super(drawable._x, drawable._y) @@ -24,6 +25,7 @@ export default class Anime extends Drawable { } catch (e) { debugger } } if (++this.j === 5) { this.i++; this.j = 0; } + if (this.i === this.frames.length && this.cb) this.cb() return this.i !== this.frames.length; } } |
