master
parent
695156a851
commit
2158f469fa
|
@ -146,7 +146,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!--小纸片氛围js-->
|
||||
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
||||
<!-- <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script> -->
|
||||
<!--小纸片氛围js-->
|
||||
|
||||
<!-- fireworks scripts -->
|
||||
|
|
37
js/custom.js
37
js/custom.js
|
@ -31,11 +31,14 @@ function allDancing(dangcing){
|
|||
$(`.people-img`).removeClass(item);
|
||||
// $(`.people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]);
|
||||
$(`.people-img`).addClass(dangcing);
|
||||
$(`.leading-dancer`).removeClass(item);
|
||||
$(`.leading-dancer`).addClass(dangcing);
|
||||
}
|
||||
})
|
||||
setTimeout(()=>{
|
||||
startIndex = 0;
|
||||
var allPeople = $('.dance-floor').find('.people-img').length;
|
||||
$(`.people-img`).removeClass(dangcing);
|
||||
suiDanTimer = setInterval(()=>{
|
||||
if(startIndex==allPeople){
|
||||
clearInterval(suiDanTimer);
|
||||
|
@ -43,31 +46,33 @@ function allDancing(dangcing){
|
|||
startIndex++;
|
||||
$(`.data${startIndex} .people-img`).addClass(actionArr[Math.floor(Math.random()*actionArr.length)]);
|
||||
}
|
||||
},3000)
|
||||
},3000)
|
||||
},1000)
|
||||
},10000)
|
||||
}
|
||||
}
|
||||
// 随机舞
|
||||
function randomDancing(id){
|
||||
var actionTimer = setInterval(()=>{
|
||||
actionArr.forEach((item,index)=>{
|
||||
// var chooseIdex = Math.floor(Math.random()*num);
|
||||
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)]);
|
||||
}
|
||||
})
|
||||
},3000)
|
||||
}
|
||||
// 个人动作舞
|
||||
function peopleAction(id,aevent){
|
||||
actionArr.forEach((item,index)=>{
|
||||
// var chooseIdex = Math.floor(Math.random()*num);
|
||||
var haveDan = $(`.data${id} .people-img`).is(`.${item}`);
|
||||
var haveDan = $(`#${id} .people-img`).is(`.${item}`);
|
||||
if(haveDan){
|
||||
$(`.data${id} .people-img`).removeClass(item);
|
||||
$(`.data${id} .people-img`).addClass(aevent);
|
||||
$(`#${id} .people-img`).removeClass(item);
|
||||
$(`#${id} .people-img`).addClass(aevent);
|
||||
} else {
|
||||
$(`#${id} .people-img`).addClass(aevent);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -104,7 +109,6 @@ function upMove(id){
|
|||
}
|
||||
// 下
|
||||
function downMove(id){
|
||||
console.log();
|
||||
var odivd = document.getElementById(`${id}`);
|
||||
downTimer = setInterval(()=>{
|
||||
if(odivd.offsetTop >500){
|
||||
|
@ -158,12 +162,10 @@ function exitEv(id){
|
|||
function peopleObj(name,uid,say,action){
|
||||
// 开始说话
|
||||
sayIng(peopleId);
|
||||
// 随机舞
|
||||
randomDancing(peopleId);
|
||||
let yspHtml = '';
|
||||
let yspData = [
|
||||
{
|
||||
id:peopleId++,
|
||||
id:'',
|
||||
uid:uid,
|
||||
top:`${Math.random()*500}px`,
|
||||
left:`${Math.random()*1500}px`,
|
||||
|
@ -186,9 +188,22 @@ function peopleObj(name,uid,say,action){
|
|||
});
|
||||
$('.dance-floor').prepend(yspHtml);
|
||||
moveEv(uid);
|
||||
// 随机舞
|
||||
randomDancing(peopleId);
|
||||
peopleId++
|
||||
// 执行退出事件
|
||||
// exitEv(`#peopleId${peopleId-1}`)
|
||||
}
|
||||
// 领舞者的动作
|
||||
function dancerOwn(dancing){
|
||||
actionArr.forEach((item,index)=>{
|
||||
var haveDan = $(`.leading-dancer`).is(`.${item}`);
|
||||
if(haveDan){
|
||||
$(`.leading-dancer`).removeClass(item);
|
||||
$(`.leading-dancer`).addClass(dancing);
|
||||
}
|
||||
})
|
||||
}
|
||||
$(function(){
|
||||
// 领舞者随机动效
|
||||
setInterval(()=>{
|
||||
|
|
41
js/handle.js
41
js/handle.js
|
@ -7,6 +7,7 @@ let leaderTime = 15*60
|
|||
|
||||
// 事件列表-中文
|
||||
let eventTextList = ['切歌', '跳跃', '向左', '向右', '左抖腿', '右抖腿', '抖动', '一起喊', '镜头']
|
||||
let allEventList = ['切歌', '一起跳跃', '一起向左', '一起向右', '一起左抖腿', '一起右抖腿', '一起抖动', '一起喊', '镜头']
|
||||
|
||||
// 根据事件文字 获取事件名
|
||||
function getEvent(name) {
|
||||
|
@ -35,7 +36,7 @@ function scale() {
|
|||
function getFirstEventKeyword(name) {
|
||||
let event = ''
|
||||
$.each(eventTextList, function (index, item) {
|
||||
if (name.indexOf(item) != -1) {
|
||||
if (name.toString().indexOf(item) != -1) {
|
||||
event = item
|
||||
return false
|
||||
}
|
||||
|
@ -69,7 +70,6 @@ function music() {
|
|||
|
||||
// 切歌
|
||||
function changeMusic() {
|
||||
console.log('切歌')
|
||||
$.get('https://bili.scdxtc.cn', function (res) {
|
||||
musicList = res
|
||||
if (musicList.length > 0) {
|
||||
|
@ -80,7 +80,14 @@ function changeMusic() {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 个人喊舞
|
||||
function peopleHan(val){
|
||||
return eventTextList.includes(val);
|
||||
}
|
||||
// 领舞喊舞
|
||||
function dancer(val){
|
||||
return allEventList.includes(val);
|
||||
}
|
||||
// 接受消息处理
|
||||
function receiveMessage(event)
|
||||
{
|
||||
|
@ -102,7 +109,7 @@ function receiveMessage(event)
|
|||
if (data.ct === '') {
|
||||
return false
|
||||
}
|
||||
|
||||
// adminList = ['饺子吃肉肉'];
|
||||
// 大航海列表
|
||||
if (adminList.length > 0) {
|
||||
// 获取当前领舞人
|
||||
|
@ -161,7 +168,7 @@ function receiveMessage(event)
|
|||
is_new: isNew, is_admin: 0, is_exit: random2, is_leader: isLeader}
|
||||
// console.log(dm,"")//
|
||||
// TODO 测试后 删除领舞随机
|
||||
let leaderRandomEvent = getEvent(getFirstEventKeyword(data.danmaku+randomEvent))
|
||||
// let leaderRandomEvent = getEvent(getFirstEventKeyword(data.danmaku+randomEvent))
|
||||
let leader = {
|
||||
// uid: 0, uname: leaderInfo, text: getEvent(getFirstEventKeyword(data.danmaku+randomEvent)), event: leaderRandomEvent
|
||||
uid: 0, uname: leaderInfo, text: '', event: ''
|
||||
|
@ -179,39 +186,43 @@ function receiveMessage(event)
|
|||
// let moveIndex = Math.floor(Math.random()*moveArr.length);
|
||||
if(dm.is_new==1){
|
||||
peopleObj(dm.uname,dm.uid,dm.text,dm.event);
|
||||
console.log(dm.event, '当前触发事件')
|
||||
} else {
|
||||
$(`#${dm.uid} .speak`).html(dm.text);
|
||||
$(`#${dm.uid} .speak`).removeClass("dn");
|
||||
setTimeout(()=>{
|
||||
$(`#${dm.uid} .speak`).addClass("dn");
|
||||
},3000)
|
||||
console.log(dm.event, '当前触发事件')
|
||||
if(peopleHan(dm.text)){
|
||||
peopleAction(`${dm.uid}`,dm.event);
|
||||
}
|
||||
// if(dm.uid=='380050580'){
|
||||
// }
|
||||
}
|
||||
num++;
|
||||
|
||||
$('.lingname').text(leader.uname);
|
||||
if(leader.event=='scale-left' || leader.event=='scale-right' || leader.event=='scale-bottom-left' || leader.event=='scale-bottom-right'){
|
||||
// 镜头
|
||||
$('.ground-bg').addClass(leader.event);
|
||||
} else {
|
||||
setTimeout(()=>{
|
||||
// console.log(leader.event);
|
||||
// 显示领舞说话
|
||||
if (leader.text.length>0) {
|
||||
$('.speak-pink').text(leader.text);
|
||||
$('.speak-pink').fadeIn();
|
||||
}
|
||||
if(leader.text=="切歌"){
|
||||
changeMusic();
|
||||
}
|
||||
setTimeout(()=>{//关闭领舞说话
|
||||
$('.speak-pink').fadeOut();
|
||||
},3000)
|
||||
allDancing(leader.event);
|
||||
},3000)
|
||||
if(leader.text=="切歌"){
|
||||
changeMusic();
|
||||
}
|
||||
if(peopleHan(dm.text)){
|
||||
dancerOwn(leader.event);
|
||||
}
|
||||
if(dancer(leader.text)){
|
||||
allDancing(leader.event);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------- 每条弹幕处理 end -----------------------
|
||||
|
||||
// event.source 就当前弹出页的来源页面
|
||||
|
|
Loading…
Reference in New Issue