diff --git a/src/components/Player.vue b/src/components/Player.vue index 16172e6..c94600d 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -4,8 +4,8 @@
- - + +
@@ -60,6 +60,9 @@ }, methods: { playPause: function () { + if (this.frames === 0) { + return + } this.playing = !this.playing if (this.playing) { this.tmp_ctx = this.$refs.canvas.getContext('2d') @@ -88,7 +91,10 @@ this.$render() if (this.position < this.frames) { this.position += 1 - requestAnimationFrame(this.$render_advance) + this.animation_id = requestAnimationFrame(this.$render_advance) + } else { + this.playPause() + this.position = 0 } } }