Compare commits

...

2 Commits

Author SHA1 Message Date
chen 58e034d7c1 新增间隔镜头 2021-12-13 13:29:13 +08:00
chen cc065c91bd 新增间隔随机镜头 2021-12-13 13:26:44 +08:00
1 changed files with 28 additions and 4 deletions

View File

@ -84,8 +84,10 @@ let userCell = {}
// 多少秒不说话删除
let speakExpireTime = 10*60
// 歌曲列表
let musicList = []
var musicList = []
// 镜头出现时间
let cameraTimer = null;
let cameraTime = 60000*3//默认3分钟
// 领舞人领舞时间 秒
let leaderTime = 15*60
// 何时添加镜头
@ -119,7 +121,6 @@ function getEvent(name) {
return map[name] ? map[name] : ''
}
// 领舞者:根据事件文字 获取事件名
function getLeaderEvent(name) {
let map = {
@ -202,7 +203,23 @@ function peopleFluo(val){
function dancer(val){
return allEventList.includes(val);
}
// 间隔多久加镜头
function cameraEv(){
cameraTimer = setInterval(()=>{
console.log('随机镜头');
list.forEach(item=>{
var haveDan = $(`.ground-bg`).is(`.${item}`);
// 如果之前有镜头,删除镜头
if(haveDan) {
$('.ground-bg').removeClass(item);
}
})
setTimeout(()=>{
$('.ground-bg').addClass(list[Math.floor(Math.random()*list.length)]);
},1000)
},cameraTime-1000)
}
cameraEv();
// 删除久未说话的人
function delExpireDiv() {
if (!autoDel) {
@ -381,6 +398,9 @@ function receiveMessage(event)
}
if(leader.event=='scale-left' || leader.event=='scale-right' || leader.event=='scale-bottom-left' || leader.event=='scale-bottom-right'){
let again = null;
clearInterval(cameraTimer);
clearTimeout(again);
// 领舞喊镜头
list.forEach(item=>{
var haveDan = $(`.ground-bg`).is(`.${item}`);
@ -393,6 +413,10 @@ function receiveMessage(event)
setTimeout(()=>{
$('.ground-bg').addClass(leader.event);
},addJingTime)
// 重新开启间隔随机镜头事件
again = setTimeout(()=>{
cameraEv();
},10000)
} else {
if(firTimes==0){
firTimes++;