弹幕隐藏时不运算动画

This commit is contained in:
Harvey committed 2020-04-26 08:43:09 +08:00
1 parent cef14a1523
commit b5d5487dcf
6 files changed
+15 -9

No files matched your search

@@ -16,6 +16,7 @@ export default class Danmuku {
this.option = {};
this.config(option);
this.isStop = false;
this.isHide = false;
this.animationFrameTimer = null;
this.$danmuku = art.template.$danmuku;
art.on('video:play', this.start.bind(this));
@@ -134,7 +135,7 @@ export default class Danmuku {
template: { $player },
} = this.art;
this.animationFrameTimer = window.requestAnimationFrame(() => {
if (player.playing) {
if (player.playing && !this.isHide) {
const danmuLeft = getRect($player, 'width');
filter(this.queue, 'emit', danmu => {
@@ -214,11 +215,13 @@ export default class Danmuku {
}
show() {
this.isHide = false;
this.$danmuku.style.display = 'block';
this.art.emit('artplayerPluginDanmuku:show');
}
hide() {
this.isHide = true;
this.$danmuku.style.display = 'none';
this.art.emit('artplayerPluginDanmuku:hide');
}