mirror of https://github.com/msgbyte/tailchat
feat: 增加原神插件抽卡动画
parent
bba3f261a2
commit
b334ac7727
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* 视频来源于 https://github.com/uzair-ashraf/genshin-impact-wish-simulator
|
||||||
|
*/
|
||||||
|
export const wishVideoUrl = {
|
||||||
|
'5star': 'https://tailchat.moonrailgun.com/genshin/5starwish.webm',
|
||||||
|
'4star': 'https://tailchat.moonrailgun.com/genshin/4starwish.webm',
|
||||||
|
'5star-single':
|
||||||
|
'https://tailchat.moonrailgun.com/genshin/5starwish-single.webm',
|
||||||
|
'4star-single':
|
||||||
|
'https://tailchat.moonrailgun.com/genshin/4starwish-single.webm',
|
||||||
|
'3star-single':
|
||||||
|
'https://tailchat.moonrailgun.com/genshin/3starwish-single.webm',
|
||||||
|
} as const;
|
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* 打开一个全屏的video
|
||||||
|
*/
|
||||||
|
export async function openFullScreenVideo(src: string) {
|
||||||
|
return new Promise<void>((resolve, reject) => {
|
||||||
|
const containerEl = document.createElement('div');
|
||||||
|
containerEl.style.position = 'fixed';
|
||||||
|
containerEl.style.height = '100vh';
|
||||||
|
containerEl.style.width = '100vw';
|
||||||
|
containerEl.style.left = '0px';
|
||||||
|
containerEl.style.top = '0px';
|
||||||
|
containerEl.style.zIndex = '99999';
|
||||||
|
containerEl.style.backgroundColor = '#000000';
|
||||||
|
containerEl.style.display = 'flex';
|
||||||
|
containerEl.style.alignItems = 'center';
|
||||||
|
containerEl.style.justifyContent = 'center';
|
||||||
|
|
||||||
|
const videoEl = document.createElement('video');
|
||||||
|
videoEl.src = src;
|
||||||
|
|
||||||
|
videoEl.autoplay = true;
|
||||||
|
videoEl.addEventListener('ended', () => {
|
||||||
|
containerEl.removeChild(videoEl);
|
||||||
|
document.body.removeChild(containerEl);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
videoEl.addEventListener('error', () => {
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
|
||||||
|
containerEl.appendChild(videoEl);
|
||||||
|
document.body.appendChild(containerEl);
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue