From 5cc98a70a08fe098d71ae8f36508aca9eba740e7 Mon Sep 17 00:00:00 2001 From: cp <463911765@qq.com> Date: Fri, 3 Dec 2021 17:07:21 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=A2=86=E8=88=9E=E6=96=87=E5=AD=97?= =?UTF-8?q?=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/style.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/css/style.css b/css/style.css index dc3aaa6..8cce2c0 100644 --- a/css/style.css +++ b/css/style.css @@ -276,11 +276,12 @@ body{ margin: -78px auto 0; display: none; min-width: 356px; + text-align: center; } .speak.speak-pink::after{ background: url(../image/icon_03.png) no-repeat; - left:60px; - + left:50%; + margin-left: -23px; } .types{ font-size: 24px; From ee77f3fe4b8651049be9bd18fe59c7cd1eba9e6b Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Mon, 6 Dec 2021 14:55:24 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E5=96=8A=E8=8D=A7=E5=85=89=E6=A3=92=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/custom.js | 69 +++++++--------------------- js/handle.js | 125 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 93 insertions(+), 101 deletions(-) diff --git a/js/custom.js b/js/custom.js index 042b1b0..0ef3d19 100644 --- a/js/custom.js +++ b/js/custom.js @@ -10,6 +10,8 @@ var allSayTimer = 5000; var actionArr = ['dancing-left','dancing-right','dancing-down','dancing-up','dancing-wobble','dancing-wobble-right']; // 人物位移动画 var moveArr = ['run-right','run-left','run-right-top','run-left-top','run-right-bottom','run-left-bottom']; +// 随机荧光棒动画 +var fluoArr = ['stick-go','stickcome']; var peopleId = 0; // 窗体宽度 var winWidth = $(window).width(); @@ -24,6 +26,8 @@ var dancingTime = 6000; var runTime = 6000; // 随机移动的定时器 var upTimer = null; +// 荧光棒关闭时间 +var fluoTime = 6000//默认6秒关闭 // 集体舞ji function allDancing(dangcing){ if(dangcing!=''){ @@ -52,17 +56,16 @@ function allDancing(dangcing){ },10000) } } -// 随机舞 +// 创建人物时随机分配舞蹈 function randomDancing(id){ - actionArr.forEach((item,index)=>{ - var haveDan = $(`.data${id} .people-img`).is(`.${item}`); - if(haveDan){ - $(`.data${id} .people-img`).removeClass(item); - $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); - } else { - $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); - } - }) + $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); +} +// 荧光棒动画事件 +function fluoEv(id,fluoEvent){ + $(`#${id} .stick`).addClass(fluoEvent); + setTimeout(()=>{ + $(`#${id} .stick`).removeClass(fluoEvent); + },fluoTime) } // 个人动作舞 function peopleAction(id,aevent){ @@ -76,55 +79,13 @@ function peopleAction(id,aevent){ } }) } -// 上 +// 位移事件 function upMove(id){ var odivu = document.getElementById(`${id}`); upTimer = setInterval(()=>{ - // if(parseInt(odivu.style.top) <=10){ - // // clearInterval(upTimer); - // // downMove(id); - // $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); - // } else { - $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); - // } + $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); },runTime) } -// // 下 -// function downMove(id){ -// var odivd = document.getElementById(`${id}`); -// var downTimer = setInterval(()=>{ -// if(parseInt(odivd.style.top) >=86){ -// clearInterval(downTimer); -// upMove(id); -// } else { -// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); -// } -// },10) -// } -// // 左 -// function leftMove(id){ -// var odivl = document.getElementById(`${id}`); -// var leftTimer = setInterval(()=>{ -// if(odivl.offsetLeft < 10){ -// clearInterval(leftTimer); -// rightMove(id); -// } else { -// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); -// } -// },10) -// } -// // 右 -// function rightMove(id){ -// var odivr = document.getElementById(`${id}`); -// var rightTimer = setInterval(()=>{ -// if(odivr.offsetLeft >= 86){ -// clearInterval(rightTimer); -// leftMove(id); -// } else { -// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); -// } -// },10) -// } // 随机位移 function moveEv(id){ upMove(id); diff --git a/js/handle.js b/js/handle.js index 697858e..43689f6 100644 --- a/js/handle.js +++ b/js/handle.js @@ -16,19 +16,21 @@ let leaderTime = 15*60 // 何时添加镜头 var addJingTime = 2000;//2秒 // 事件列表-中文 -let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头'] +let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头','击剑','起飞'] +// 个人---荧光棒列表-中文 +let fluoTextList = ['击剑','起飞']; +// 领舞---荧光棒列表-中文 +let leaderFluoList = ['一起击剑','一起起飞']; // 领舞者喊的集体舞 let allEventList = ['切歌', '一起跳', '一起向左', '一起向右', '一起左抖腿', '一起右抖腿', '一起抖动', '一起喊', '镜头'] // 镜头列表 let list = ['scale-left', 'scale-right', 'scale-bottom-left', 'scale-bottom-right'] // 烟花次数 let firTimes = 0; -// 根据事件文字 获取事件名 +// 个人喊舞:根据事件文字 获取事件名 function getEvent(name) { let map = { '烟花':'fireworks', - '一起击剑':'stickcome', - '起飞':'stickgo', '切歌' : 'change_song', '跳' : 'dancing-down', '向左' : 'dancing-left', @@ -43,12 +45,10 @@ function getEvent(name) { return map[name] ? map[name] : '' } -// 根据事件文字 获取领舞者事件名 +// 领舞者:根据事件文字 获取事件名 function getLeaderEvent(name) { let map = { '烟花':'fireworks', - '一起击剑':'stickcome', - '起飞':'stickgo', '切歌' : 'change_song', '一起跳' : 'dancing-down', '一起向左' : 'dancing-left', @@ -62,22 +62,29 @@ function getLeaderEvent(name) { return map[name] ? map[name] : '' } - +// +function getLeaderFluoEvent(name) { + let leadMap = { + '一起击剑':'stickcome', + '一起起飞':'stick-go' + } + return leadMap[name] ? leadMap[name] : '' +} // 随机选择镜头 function scale() { return list[Math.floor(Math.random() * 3)]; } // 字符串包含的事件 (仅取第一个) -function getFirstEventKeyword(name) { - let event = '' - $.each(eventTextList, function (index, item) { - if (name.toString().indexOf(item) != -1) { - event = item - return false - } - }) - return event -} +// function getFirstEventKeyword(name) { +// let event = '' +// $.each(eventTextList, function (index, item) { +// if (name.toString().indexOf(item) != -1) { +// event = item +// return false +// } +// }) +// return event +// } function music() { $.get(musicUrl, function (res) { @@ -104,6 +111,18 @@ function changeMusic() { function peopleHan(val){ return eventTextList.includes(val); } +// 领舞者:根据事件文字 获取事件名 +function getFluoEvent(name) { + let fluoMap = { + '击剑':'stickcome', + '起飞':'stick-go' + } + return fluoMap[name] ? fluoMap[name] : '' +} +// 个人喊荧光棒 +function peopleFluo(val){ + return fluoTextList.includes(val); +} // 领舞喊舞 function dancer(val){ return allEventList.includes(val); @@ -156,12 +175,12 @@ function receiveMessage(event) // 领舞信息 目前为领舞名称 let leaderInfo = '' - // 高能榜第一位设为领舞 - if (highList.length > 0) { + if (highList!=undefined && highList.length > 0) { leaderInfo = highList[0] } - // leaderInfo = '内有猛犬小心' + leaderInfo = '内有猛犬小心' + // leaderInfo = '饺子吃肉肉' // uid是否存在 不存在则存入uidObj let isNew = 0 @@ -198,7 +217,6 @@ function receiveMessage(event) leader.text = dm.text leader.event = eventName ? eventName : leaderEvent } - // 新用户 if(dm.is_new==1){ // if(dm.uname!=leader.uname){//如果弹幕的人的名字不等于领舞者的名字,就创建一个人物 @@ -214,13 +232,17 @@ function receiveMessage(event) // 舰长添加大宝剑 $(`#${dm.uid} .stick`).addClass("stick-swing-big-tow"); } - setTimeout(()=>{ + setTimeout(()=>{//关闭当前说话 $(`#${dm.uid} .speak`).addClass("dn"); },3000) - // 舞者喊舞 + // 舞者喊舞---动作舞 if(peopleHan(dm.text)){ peopleAction(`${dm.uid}`,dm.event); } + // 舞者喊舞---荧光棒 + if(peopleFluo(dm.text)){ + fluoEv(`${dm.uid}`,getFluoEvent(dm.text)); + } } num++; @@ -271,29 +293,29 @@ function receiveMessage(event) } } //领舞起飞 - if(leader.text==="起飞"){ - if(firTimes==0){ - firTimes++; - $('.stick').removeClass('stick-swing'); - $('.stick').addClass('stick-go'); - setTimeout(()=>{ - $('.stick').removeClass('stick-go'); - $('.stick').addClass('stick-swing'); - firTimes = 0; - },6000) - } - } + // if(leader.text==="起飞"){ + // if(firTimes==0){ + // firTimes++; + // $('.stick').removeClass('stick-swing'); + // $('.stick').addClass('stick-go'); + // setTimeout(()=>{ + // $('.stick').removeClass('stick-go'); + // $('.stick').addClass('stick-swing'); + // firTimes = 0; + // },6000) + // } + // } //一起击剑 - if(leader.text==="一起击剑"){ - if(firTimes==0){ - firTimes++; - $('.stick').addClass('stickcome'); - setTimeout(()=>{ - $('.stick').removeClass('stickcome'); - firTimes = 0; - },6000) - } - } + // if(leader.text==="一起击剑"){ + // if(firTimes==0){ + // firTimes++; + // $('.stick').addClass('stickcome'); + // setTimeout(()=>{ + // $('.stick').removeClass('stickcome'); + // firTimes = 0; + // },6000) + // } + // } // 领舞喊一起喊 if (leader.text.length >= 4) { @@ -301,7 +323,6 @@ function receiveMessage(event) allSay(leader.text.slice(4)); } } - // 领舞自己喊跳舞 if(peopleHan(dm.text)){ clearInterval(dancerTimer); @@ -311,6 +332,16 @@ function receiveMessage(event) if(dancer(leader.text)){ allDancing(leader.event); } + // 领舞喊荧光棒事件 + if(getLeaderFluoEvent(leader.text)!=''){ + if(firTimes==0){//防多次说话 + firTimes++; + console.log(getLeaderFluoEvent(leader.text)); + setTimeout(()=>{ + firTimes = 0; + },5000) + } + } } // -------------------- 每条弹幕处理 end ----------------------- } From c5fcb3d64edf80504ff6eccb40845e6e67a9b71e Mon Sep 17 00:00:00 2001 From: cp <463911765@qq.com> Date: Mon, 6 Dec 2021 15:10:50 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/custom.js | 69 +++++++++++++++++++++------- js/handle.js | 125 +++++++++++++++++++-------------------------------- 2 files changed, 101 insertions(+), 93 deletions(-) diff --git a/js/custom.js b/js/custom.js index 0ef3d19..042b1b0 100644 --- a/js/custom.js +++ b/js/custom.js @@ -10,8 +10,6 @@ var allSayTimer = 5000; var actionArr = ['dancing-left','dancing-right','dancing-down','dancing-up','dancing-wobble','dancing-wobble-right']; // 人物位移动画 var moveArr = ['run-right','run-left','run-right-top','run-left-top','run-right-bottom','run-left-bottom']; -// 随机荧光棒动画 -var fluoArr = ['stick-go','stickcome']; var peopleId = 0; // 窗体宽度 var winWidth = $(window).width(); @@ -26,8 +24,6 @@ var dancingTime = 6000; var runTime = 6000; // 随机移动的定时器 var upTimer = null; -// 荧光棒关闭时间 -var fluoTime = 6000//默认6秒关闭 // 集体舞ji function allDancing(dangcing){ if(dangcing!=''){ @@ -56,16 +52,17 @@ function allDancing(dangcing){ },10000) } } -// 创建人物时随机分配舞蹈 +// 随机舞 function randomDancing(id){ - $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); -} -// 荧光棒动画事件 -function fluoEv(id,fluoEvent){ - $(`#${id} .stick`).addClass(fluoEvent); - setTimeout(()=>{ - $(`#${id} .stick`).removeClass(fluoEvent); - },fluoTime) + actionArr.forEach((item,index)=>{ + var haveDan = $(`.data${id} .people-img`).is(`.${item}`); + if(haveDan){ + $(`.data${id} .people-img`).removeClass(item); + $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); + } else { + $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); + } + }) } // 个人动作舞 function peopleAction(id,aevent){ @@ -79,13 +76,55 @@ function peopleAction(id,aevent){ } }) } -// 位移事件 +// 上 function upMove(id){ var odivu = document.getElementById(`${id}`); upTimer = setInterval(()=>{ - $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); + // if(parseInt(odivu.style.top) <=10){ + // // clearInterval(upTimer); + // // downMove(id); + // $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); + // } else { + $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); + // } },runTime) } +// // 下 +// function downMove(id){ +// var odivd = document.getElementById(`${id}`); +// var downTimer = setInterval(()=>{ +// if(parseInt(odivd.style.top) >=86){ +// clearInterval(downTimer); +// upMove(id); +// } else { +// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); +// } +// },10) +// } +// // 左 +// function leftMove(id){ +// var odivl = document.getElementById(`${id}`); +// var leftTimer = setInterval(()=>{ +// if(odivl.offsetLeft < 10){ +// clearInterval(leftTimer); +// rightMove(id); +// } else { +// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); +// } +// },10) +// } +// // 右 +// function rightMove(id){ +// var odivr = document.getElementById(`${id}`); +// var rightTimer = setInterval(()=>{ +// if(odivr.offsetLeft >= 86){ +// clearInterval(rightTimer); +// leftMove(id); +// } else { +// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); +// } +// },10) +// } // 随机位移 function moveEv(id){ upMove(id); diff --git a/js/handle.js b/js/handle.js index 43689f6..697858e 100644 --- a/js/handle.js +++ b/js/handle.js @@ -16,21 +16,19 @@ let leaderTime = 15*60 // 何时添加镜头 var addJingTime = 2000;//2秒 // 事件列表-中文 -let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头','击剑','起飞'] -// 个人---荧光棒列表-中文 -let fluoTextList = ['击剑','起飞']; -// 领舞---荧光棒列表-中文 -let leaderFluoList = ['一起击剑','一起起飞']; +let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头'] // 领舞者喊的集体舞 let allEventList = ['切歌', '一起跳', '一起向左', '一起向右', '一起左抖腿', '一起右抖腿', '一起抖动', '一起喊', '镜头'] // 镜头列表 let list = ['scale-left', 'scale-right', 'scale-bottom-left', 'scale-bottom-right'] // 烟花次数 let firTimes = 0; -// 个人喊舞:根据事件文字 获取事件名 +// 根据事件文字 获取事件名 function getEvent(name) { let map = { '烟花':'fireworks', + '一起击剑':'stickcome', + '起飞':'stickgo', '切歌' : 'change_song', '跳' : 'dancing-down', '向左' : 'dancing-left', @@ -45,10 +43,12 @@ function getEvent(name) { return map[name] ? map[name] : '' } -// 领舞者:根据事件文字 获取事件名 +// 根据事件文字 获取领舞者事件名 function getLeaderEvent(name) { let map = { '烟花':'fireworks', + '一起击剑':'stickcome', + '起飞':'stickgo', '切歌' : 'change_song', '一起跳' : 'dancing-down', '一起向左' : 'dancing-left', @@ -62,29 +62,22 @@ function getLeaderEvent(name) { return map[name] ? map[name] : '' } -// -function getLeaderFluoEvent(name) { - let leadMap = { - '一起击剑':'stickcome', - '一起起飞':'stick-go' - } - return leadMap[name] ? leadMap[name] : '' -} + // 随机选择镜头 function scale() { return list[Math.floor(Math.random() * 3)]; } // 字符串包含的事件 (仅取第一个) -// function getFirstEventKeyword(name) { -// let event = '' -// $.each(eventTextList, function (index, item) { -// if (name.toString().indexOf(item) != -1) { -// event = item -// return false -// } -// }) -// return event -// } +function getFirstEventKeyword(name) { + let event = '' + $.each(eventTextList, function (index, item) { + if (name.toString().indexOf(item) != -1) { + event = item + return false + } + }) + return event +} function music() { $.get(musicUrl, function (res) { @@ -111,18 +104,6 @@ function changeMusic() { function peopleHan(val){ return eventTextList.includes(val); } -// 领舞者:根据事件文字 获取事件名 -function getFluoEvent(name) { - let fluoMap = { - '击剑':'stickcome', - '起飞':'stick-go' - } - return fluoMap[name] ? fluoMap[name] : '' -} -// 个人喊荧光棒 -function peopleFluo(val){ - return fluoTextList.includes(val); -} // 领舞喊舞 function dancer(val){ return allEventList.includes(val); @@ -175,12 +156,12 @@ function receiveMessage(event) // 领舞信息 目前为领舞名称 let leaderInfo = '' + // 高能榜第一位设为领舞 - if (highList!=undefined && highList.length > 0) { + if (highList.length > 0) { leaderInfo = highList[0] } - leaderInfo = '内有猛犬小心' - // leaderInfo = '饺子吃肉肉' + // leaderInfo = '内有猛犬小心' // uid是否存在 不存在则存入uidObj let isNew = 0 @@ -217,6 +198,7 @@ function receiveMessage(event) leader.text = dm.text leader.event = eventName ? eventName : leaderEvent } + // 新用户 if(dm.is_new==1){ // if(dm.uname!=leader.uname){//如果弹幕的人的名字不等于领舞者的名字,就创建一个人物 @@ -232,17 +214,13 @@ function receiveMessage(event) // 舰长添加大宝剑 $(`#${dm.uid} .stick`).addClass("stick-swing-big-tow"); } - setTimeout(()=>{//关闭当前说话 + setTimeout(()=>{ $(`#${dm.uid} .speak`).addClass("dn"); },3000) - // 舞者喊舞---动作舞 + // 舞者喊舞 if(peopleHan(dm.text)){ peopleAction(`${dm.uid}`,dm.event); } - // 舞者喊舞---荧光棒 - if(peopleFluo(dm.text)){ - fluoEv(`${dm.uid}`,getFluoEvent(dm.text)); - } } num++; @@ -293,29 +271,29 @@ function receiveMessage(event) } } //领舞起飞 - // if(leader.text==="起飞"){ - // if(firTimes==0){ - // firTimes++; - // $('.stick').removeClass('stick-swing'); - // $('.stick').addClass('stick-go'); - // setTimeout(()=>{ - // $('.stick').removeClass('stick-go'); - // $('.stick').addClass('stick-swing'); - // firTimes = 0; - // },6000) - // } - // } + if(leader.text==="起飞"){ + if(firTimes==0){ + firTimes++; + $('.stick').removeClass('stick-swing'); + $('.stick').addClass('stick-go'); + setTimeout(()=>{ + $('.stick').removeClass('stick-go'); + $('.stick').addClass('stick-swing'); + firTimes = 0; + },6000) + } + } //一起击剑 - // if(leader.text==="一起击剑"){ - // if(firTimes==0){ - // firTimes++; - // $('.stick').addClass('stickcome'); - // setTimeout(()=>{ - // $('.stick').removeClass('stickcome'); - // firTimes = 0; - // },6000) - // } - // } + if(leader.text==="一起击剑"){ + if(firTimes==0){ + firTimes++; + $('.stick').addClass('stickcome'); + setTimeout(()=>{ + $('.stick').removeClass('stickcome'); + firTimes = 0; + },6000) + } + } // 领舞喊一起喊 if (leader.text.length >= 4) { @@ -323,6 +301,7 @@ function receiveMessage(event) allSay(leader.text.slice(4)); } } + // 领舞自己喊跳舞 if(peopleHan(dm.text)){ clearInterval(dancerTimer); @@ -332,16 +311,6 @@ function receiveMessage(event) if(dancer(leader.text)){ allDancing(leader.event); } - // 领舞喊荧光棒事件 - if(getLeaderFluoEvent(leader.text)!=''){ - if(firTimes==0){//防多次说话 - firTimes++; - console.log(getLeaderFluoEvent(leader.text)); - setTimeout(()=>{ - firTimes = 0; - },5000) - } - } } // -------------------- 每条弹幕处理 end ----------------------- } From 8855992e5083311110c59b4ac80c07d2b2aeebc1 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Tue, 7 Dec 2021 13:39:25 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E8=B5=B7?= =?UTF-8?q?=E5=87=BB=E5=89=91=E3=80=81=E4=B8=80=E8=B5=B7=E8=B5=B7=E9=A3=9E?= =?UTF-8?q?=E3=80=81=E8=B5=B7=E9=A3=9E=E3=80=81=E5=87=BB=E5=89=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/handle.js | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/js/handle.js b/js/handle.js index 43689f6..7bc4c74 100644 --- a/js/handle.js +++ b/js/handle.js @@ -179,8 +179,8 @@ function receiveMessage(event) if (highList!=undefined && highList.length > 0) { leaderInfo = highList[0] } - leaderInfo = '内有猛犬小心' - // leaderInfo = '饺子吃肉肉' + // leaderInfo = '内有猛犬小心' + leaderInfo = '饺子吃肉肉' // uid是否存在 不存在则存入uidObj let isNew = 0 @@ -293,29 +293,29 @@ function receiveMessage(event) } } //领舞起飞 - // if(leader.text==="起飞"){ - // if(firTimes==0){ - // firTimes++; - // $('.stick').removeClass('stick-swing'); - // $('.stick').addClass('stick-go'); - // setTimeout(()=>{ - // $('.stick').removeClass('stick-go'); - // $('.stick').addClass('stick-swing'); - // firTimes = 0; - // },6000) - // } - // } + if(leader.text==="起飞"){ + if(firTimes==0){ + firTimes++; + $('.stick').removeClass('stick-swing'); + $('.stick').addClass('stick-go'); + setTimeout(()=>{ + $('.stick').removeClass('stick-go'); + $('.stick').addClass('stick-swing'); + firTimes = 0; + },6000) + } + } //一起击剑 - // if(leader.text==="一起击剑"){ - // if(firTimes==0){ - // firTimes++; - // $('.stick').addClass('stickcome'); - // setTimeout(()=>{ - // $('.stick').removeClass('stickcome'); - // firTimes = 0; - // },6000) - // } - // } + if(leader.text==="一起击剑"){ + if(firTimes==0){ + firTimes++; + $('.stick').addClass('stickcome'); + setTimeout(()=>{ + $('.stick').removeClass('stickcome'); + firTimes = 0; + },6000) + } + } // 领舞喊一起喊 if (leader.text.length >= 4) { @@ -333,15 +333,15 @@ function receiveMessage(event) allDancing(leader.event); } // 领舞喊荧光棒事件 - if(getLeaderFluoEvent(leader.text)!=''){ - if(firTimes==0){//防多次说话 - firTimes++; - console.log(getLeaderFluoEvent(leader.text)); - setTimeout(()=>{ - firTimes = 0; - },5000) - } - } + // if(getLeaderFluoEvent(leader.text)!=''){ + // if(firTimes==0){//防多次说话 + // firTimes++; + // console.log(getLeaderFluoEvent(leader.text)); + // setTimeout(()=>{ + // firTimes = 0; + // },5000) + // } + // } } // -------------------- 每条弹幕处理 end ----------------------- } From e8d8f183fcd89f9ed36203950bca972acc8e395d Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Tue, 7 Dec 2021 13:43:20 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=87=BB=E5=89=91?= =?UTF-8?q?=E3=80=81=E8=B5=B7=E9=A3=9E=E3=80=81=E4=B8=80=E8=B5=B7=E5=87=BB?= =?UTF-8?q?=E5=89=91=E3=80=81=E4=B8=80=E8=B5=B7=E8=B5=B7=E9=A3=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/custom.js | 69 +++++---------------- js/handle.js | 170 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 115 insertions(+), 124 deletions(-) diff --git a/js/custom.js b/js/custom.js index 042b1b0..0ef3d19 100644 --- a/js/custom.js +++ b/js/custom.js @@ -10,6 +10,8 @@ var allSayTimer = 5000; var actionArr = ['dancing-left','dancing-right','dancing-down','dancing-up','dancing-wobble','dancing-wobble-right']; // 人物位移动画 var moveArr = ['run-right','run-left','run-right-top','run-left-top','run-right-bottom','run-left-bottom']; +// 随机荧光棒动画 +var fluoArr = ['stick-go','stickcome']; var peopleId = 0; // 窗体宽度 var winWidth = $(window).width(); @@ -24,6 +26,8 @@ var dancingTime = 6000; var runTime = 6000; // 随机移动的定时器 var upTimer = null; +// 荧光棒关闭时间 +var fluoTime = 6000//默认6秒关闭 // 集体舞ji function allDancing(dangcing){ if(dangcing!=''){ @@ -52,17 +56,16 @@ function allDancing(dangcing){ },10000) } } -// 随机舞 +// 创建人物时随机分配舞蹈 function randomDancing(id){ - actionArr.forEach((item,index)=>{ - var haveDan = $(`.data${id} .people-img`).is(`.${item}`); - if(haveDan){ - $(`.data${id} .people-img`).removeClass(item); - $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); - } else { - $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); - } - }) + $(`.data${id} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]); +} +// 荧光棒动画事件 +function fluoEv(id,fluoEvent){ + $(`#${id} .stick`).addClass(fluoEvent); + setTimeout(()=>{ + $(`#${id} .stick`).removeClass(fluoEvent); + },fluoTime) } // 个人动作舞 function peopleAction(id,aevent){ @@ -76,55 +79,13 @@ function peopleAction(id,aevent){ } }) } -// 上 +// 位移事件 function upMove(id){ var odivu = document.getElementById(`${id}`); upTimer = setInterval(()=>{ - // if(parseInt(odivu.style.top) <=10){ - // // clearInterval(upTimer); - // // downMove(id); - // $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); - // } else { - $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); - // } + $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); },runTime) } -// // 下 -// function downMove(id){ -// var odivd = document.getElementById(`${id}`); -// var downTimer = setInterval(()=>{ -// if(parseInt(odivd.style.top) >=86){ -// clearInterval(downTimer); -// upMove(id); -// } else { -// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); -// } -// },10) -// } -// // 左 -// function leftMove(id){ -// var odivl = document.getElementById(`${id}`); -// var leftTimer = setInterval(()=>{ -// if(odivl.offsetLeft < 10){ -// clearInterval(leftTimer); -// rightMove(id); -// } else { -// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); -// } -// },10) -// } -// // 右 -// function rightMove(id){ -// var odivr = document.getElementById(`${id}`); -// var rightTimer = setInterval(()=>{ -// if(odivr.offsetLeft >= 86){ -// clearInterval(rightTimer); -// leftMove(id); -// } else { -// $(`#${id}`).animate({top:`${Math.floor(Math.random()*90)}%`,left:`${Math.floor(Math.random()*90)}%`},Math.floor(Math.random()*40000+10000)); -// } -// },10) -// } // 随机位移 function moveEv(id){ upMove(id); diff --git a/js/handle.js b/js/handle.js index 697858e..e5e1977 100644 --- a/js/handle.js +++ b/js/handle.js @@ -16,19 +16,21 @@ let leaderTime = 15*60 // 何时添加镜头 var addJingTime = 2000;//2秒 // 事件列表-中文 -let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头'] +let eventTextList = ['切歌', '跳', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头','击剑','起飞'] +// 个人---荧光棒列表-中文 +let fluoTextList = ['击剑','起飞']; +// 领舞---荧光棒列表-中文 +let leaderFluoList = ['一起击剑','一起起飞']; // 领舞者喊的集体舞 let allEventList = ['切歌', '一起跳', '一起向左', '一起向右', '一起左抖腿', '一起右抖腿', '一起抖动', '一起喊', '镜头'] // 镜头列表 let list = ['scale-left', 'scale-right', 'scale-bottom-left', 'scale-bottom-right'] // 烟花次数 let firTimes = 0; -// 根据事件文字 获取事件名 +// 个人喊舞:根据事件文字 获取事件名 function getEvent(name) { let map = { '烟花':'fireworks', - '一起击剑':'stickcome', - '起飞':'stickgo', '切歌' : 'change_song', '跳' : 'dancing-down', '向左' : 'dancing-left', @@ -43,12 +45,10 @@ function getEvent(name) { return map[name] ? map[name] : '' } -// 根据事件文字 获取领舞者事件名 +// 领舞者:根据事件文字 获取事件名 function getLeaderEvent(name) { let map = { '烟花':'fireworks', - '一起击剑':'stickcome', - '起飞':'stickgo', '切歌' : 'change_song', '一起跳' : 'dancing-down', '一起向左' : 'dancing-left', @@ -62,22 +62,29 @@ function getLeaderEvent(name) { return map[name] ? map[name] : '' } - +// +function getLeaderFluoEvent(name) { + let leadMap = { + '一起击剑':'stickcome', + '一起起飞':'stick-go' + } + return leadMap[name] ? leadMap[name] : '' +} // 随机选择镜头 function scale() { return list[Math.floor(Math.random() * 3)]; } // 字符串包含的事件 (仅取第一个) -function getFirstEventKeyword(name) { - let event = '' - $.each(eventTextList, function (index, item) { - if (name.toString().indexOf(item) != -1) { - event = item - return false - } - }) - return event -} +// function getFirstEventKeyword(name) { +// let event = '' +// $.each(eventTextList, function (index, item) { +// if (name.toString().indexOf(item) != -1) { +// event = item +// return false +// } +// }) +// return event +// } function music() { $.get(musicUrl, function (res) { @@ -104,6 +111,18 @@ function changeMusic() { function peopleHan(val){ return eventTextList.includes(val); } +// 领舞者:根据事件文字 获取事件名 +function getFluoEvent(name) { + let fluoMap = { + '击剑':'stickcome', + '起飞':'stick-go' + } + return fluoMap[name] ? fluoMap[name] : '' +} +// 个人喊荧光棒 +function peopleFluo(val){ + return fluoTextList.includes(val); +} // 领舞喊舞 function dancer(val){ return allEventList.includes(val); @@ -122,7 +141,6 @@ function delExpireDiv() { // console.log(delList.length, speakExpireTime+'秒未说话人数') delList.remove(); } - // 接受消息处理 function receiveMessage(event) { @@ -156,12 +174,12 @@ function receiveMessage(event) // 领舞信息 目前为领舞名称 let leaderInfo = '' - // 高能榜第一位设为领舞 - if (highList.length > 0) { + if (highList!=undefined && highList.length > 0) { leaderInfo = highList[0] } // leaderInfo = '内有猛犬小心' + // leaderInfo = '饺子吃肉肉' // uid是否存在 不存在则存入uidObj let isNew = 0 @@ -198,7 +216,6 @@ function receiveMessage(event) leader.text = dm.text leader.event = eventName ? eventName : leaderEvent } - // 新用户 if(dm.is_new==1){ // if(dm.uname!=leader.uname){//如果弹幕的人的名字不等于领舞者的名字,就创建一个人物 @@ -214,13 +231,17 @@ function receiveMessage(event) // 舰长添加大宝剑 $(`#${dm.uid} .stick`).addClass("stick-swing-big-tow"); } - setTimeout(()=>{ + setTimeout(()=>{//关闭当前说话 $(`#${dm.uid} .speak`).addClass("dn"); },3000) - // 舞者喊舞 + // 舞者喊舞---动作舞 if(peopleHan(dm.text)){ peopleAction(`${dm.uid}`,dm.event); } + // 舞者喊舞---荧光棒 + if(peopleFluo(dm.text)){ + fluoEv(`${dm.uid}`,getFluoEvent(dm.text)); + } } num++; @@ -247,69 +268,78 @@ function receiveMessage(event) $('.ground-bg').addClass(leader.event); },addJingTime) } else { - // 显示领舞说话 - if (leader.text.length>0) { - $('.speak-pink').text(leader.text); - $('.speak-pink').fadeIn(); - //关闭领舞说话 - setTimeout(()=>{ - $('.speak-pink').fadeOut(); - },3000) - } - // 领舞说切歌 - if(leader.text=="切歌"){ - changeMusic(); - } - if(leader.text==="烟花"){ - if(firTimes==0){ - firTimes++; + if(firTimes==0){ + firTimes++; + // 显示领舞说话 + if (leader.text.length>0) { + $('.speak-pink').text(leader.text); + $('.speak-pink').fadeIn(); + //关闭领舞说话 + setTimeout(()=>{ + $('.speak-pink').fadeOut(); + },3000) + } + // 领舞说切歌 + if(leader.text=="切歌"){ + changeMusic(); + } + if(leader.text==="烟花"){ $('.lighting-bg').addClass('fireworks'); setTimeout(()=>{ $('.lighting-bg').removeClass('fireworks'); - firTimes = 0; },5000) } - } - //领舞起飞 - if(leader.text==="起飞"){ - if(firTimes==0){ - firTimes++; + //领舞起飞 + if(leader.text==="一起起飞"){ $('.stick').removeClass('stick-swing'); $('.stick').addClass('stick-go'); setTimeout(()=>{ $('.stick').removeClass('stick-go'); $('.stick').addClass('stick-swing'); - firTimes = 0; },6000) } - } - //一起击剑 - if(leader.text==="一起击剑"){ - if(firTimes==0){ - firTimes++; + if(leader.text==="一起击剑"){//一起击剑 $('.stick').addClass('stickcome'); setTimeout(()=>{ $('.stick').removeClass('stickcome'); - firTimes = 0; },6000) } - } - - // 领舞喊一起喊 - if (leader.text.length >= 4) { - if(leader.text.slice(0,4)=="一起喊:" || leader.text.slice(0,4)=="一起喊:"){ - allSay(leader.text.slice(4)); - } - } - - // 领舞自己喊跳舞 - if(peopleHan(dm.text)){ - clearInterval(dancerTimer); - dancerOwn(leader.event); - } - // 领舞喊集体跳舞 - if(dancer(leader.text)){ - allDancing(leader.event); + if(peopleFluo(leader.text)){ + $('.stick').removeClass('stick-swing'); + $('.stick').addClass(getFluoEvent(dm.text)); + setTimeout(()=>{ + $('.stick').removeClass(getFluoEvent(dm.text)); + $('.stick').addClass('stick-swing'); + },6000) + } + setTimeout(()=>{ + firTimes = 0; + },2000) + // 领舞喊一起喊 + if (leader.text.length >= 4) { + if(leader.text.slice(0,4)=="一起喊:" || leader.text.slice(0,4)=="一起喊:"){ + allSay(leader.text.slice(4)); + } + } + // 领舞自己喊跳舞 + if(peopleHan(dm.text)){ + clearInterval(dancerTimer); + dancerOwn(leader.event); + } + // 领舞喊集体跳舞 + if(dancer(leader.text)){ + allDancing(leader.event); + } + // 领舞喊荧光棒事件 + // if(getLeaderFluoEvent(leader.text)!=''){ + // if(firTimes==0){//防多次说话 + // firTimes++; + // console.log(getLeaderFluoEvent(leader.text)); + // setTimeout(()=>{ + // firTimes = 0; + // },5000) + // } + // } } } // -------------------- 每条弹幕处理 end ----------------------- From dbfbc43162f8b346f1b63ba234309a7d66855ac4 Mon Sep 17 00:00:00 2001 From: cp <463911765@qq.com> Date: Tue, 7 Dec 2021 13:48:31 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/handle.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/js/handle.js b/js/handle.js index 2c577ee..3e3c0a0 100644 --- a/js/handle.js +++ b/js/handle.js @@ -179,14 +179,6 @@ function receiveMessage(event) leaderInfo = highList[0] } // leaderInfo = '内有猛犬小心' -<<<<<<< HEAD - // leaderInfo = '饺子吃肉肉' -======= -<<<<<<< HEAD - leaderInfo = '饺子吃肉肉' -======= ->>>>>>> c5fcb3d64edf80504ff6eccb40845e6e67a9b71e ->>>>>>> 41a44859b9fcbc567c4e2c148584eb120ba9900e // uid是否存在 不存在则存入uidObj let isNew = 0 @@ -348,19 +340,6 @@ function receiveMessage(event) // } // } } -<<<<<<< HEAD - // 领舞喊荧光棒事件 - // if(getLeaderFluoEvent(leader.text)!=''){ - // if(firTimes==0){//防多次说话 - // firTimes++; - // console.log(getLeaderFluoEvent(leader.text)); - // setTimeout(()=>{ - // firTimes = 0; - // },5000) - // } - // } -======= ->>>>>>> c5fcb3d64edf80504ff6eccb40845e6e67a9b71e } // -------------------- 每条弹幕处理 end ----------------------- } From 1464b529b24b161886e3d501de8f1baa56ba4fa1 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Tue, 7 Dec 2021 13:55:56 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=87=BB=E5=89=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/handle.js | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/js/handle.js b/js/handle.js index 2c577ee..a1a829c 100644 --- a/js/handle.js +++ b/js/handle.js @@ -179,14 +179,7 @@ function receiveMessage(event) leaderInfo = highList[0] } // leaderInfo = '内有猛犬小心' -<<<<<<< HEAD - // leaderInfo = '饺子吃肉肉' -======= -<<<<<<< HEAD leaderInfo = '饺子吃肉肉' -======= ->>>>>>> c5fcb3d64edf80504ff6eccb40845e6e67a9b71e ->>>>>>> 41a44859b9fcbc567c4e2c148584eb120ba9900e // uid是否存在 不存在则存入uidObj let isNew = 0 @@ -312,11 +305,11 @@ function receiveMessage(event) },6000) } if(peopleFluo(leader.text)){ - $('.stick').removeClass('stick-swing'); - $('.stick').addClass(getFluoEvent(dm.text)); + $('.leading .stick').removeClass('stick-swing'); + $('.leading .stick').addClass(getFluoEvent(dm.text)); setTimeout(()=>{ - $('.stick').removeClass(getFluoEvent(dm.text)); - $('.stick').addClass('stick-swing'); + $('.leading .stick').removeClass(getFluoEvent(dm.text)); + $('.leading .stick').addClass('stick-swing'); },6000) } setTimeout(()=>{ @@ -348,19 +341,6 @@ function receiveMessage(event) // } // } } -<<<<<<< HEAD - // 领舞喊荧光棒事件 - // if(getLeaderFluoEvent(leader.text)!=''){ - // if(firTimes==0){//防多次说话 - // firTimes++; - // console.log(getLeaderFluoEvent(leader.text)); - // setTimeout(()=>{ - // firTimes = 0; - // },5000) - // } - // } -======= ->>>>>>> c5fcb3d64edf80504ff6eccb40845e6e67a9b71e } // -------------------- 每条弹幕处理 end ----------------------- }