update danmuku.js

This commit is contained in:
Harvey Zack committed 2022-04-29 22:02:47 +08:00
1 parent 5667235d8d
commit 58e18c1d60
5 files changed
+91 -87

No files matched your search

@@ -23,6 +23,8 @@ export default class Danmuku {
art.on('video:waiting', this.stop.bind(this));
art.on('resize', this.resize.bind(this));
art.on('destroy', this.stop.bind(this));
art.on('fullscreen', this.reset.bind(this));
art.on('fullscreenWeb', this.reset.bind(this));
this.load();
}
@@ -268,6 +270,24 @@ export default class Danmuku {
return this;
}
reset() {
const { $player } = this.art.template;
const { width: playerWidth } = this.getRect($player);
this.filter('emit', (danmu) => {
if (danmu.$ref) {
danmu.$state = 'wait';
danmu.$ref.dataset.state = 'wait';
danmu.$ref.style.border = 'none';
danmu.$ref.style.visibility = 'hidden';
danmu.$ref.style.left = `${playerWidth}px`;
danmu.$ref.style.marginLeft = '0px';
danmu.$ref.style.transform = 'translateX(0px) translateY(0px) translateZ(0px)';
danmu.$ref.style.transition = 'transform 0s linear 0s';
}
});
}
update() {
const { $player } = this.art.template;
this.animationFrameTimer = window.requestAnimationFrame(() => {