Compare commits
2 Commits
f87a786e7c
...
3d71b732be
Author | SHA1 | Date |
---|---|---|
chen | 3d71b732be | |
chen | 7a08510c6a |
33
js/custom.js
33
js/custom.js
|
@ -37,7 +37,6 @@ function allDancing(dangcing){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
clearInterval(actionTimer);
|
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
var allPeople = $('.dance-floor').find('.people-img').length;
|
var allPeople = $('.dance-floor').find('.people-img').length;
|
||||||
suiDanTimer = setInterval(()=>{
|
suiDanTimer = setInterval(()=>{
|
||||||
|
@ -53,7 +52,7 @@ function allDancing(dangcing){
|
||||||
}
|
}
|
||||||
// 随机舞
|
// 随机舞
|
||||||
function randomDancing(id){
|
function randomDancing(id){
|
||||||
actionTimer = setInterval(()=>{
|
var actionTimer = setInterval(()=>{
|
||||||
actionArr.forEach((item,index)=>{
|
actionArr.forEach((item,index)=>{
|
||||||
// var chooseIdex = Math.floor(Math.random()*num);
|
// var chooseIdex = Math.floor(Math.random()*num);
|
||||||
var haveDan = $(`.data${id} .people-img`).is(`.${item}`);
|
var haveDan = $(`.data${id} .people-img`).is(`.${item}`);
|
||||||
|
@ -65,24 +64,19 @@ function randomDancing(id){
|
||||||
},3000)
|
},3000)
|
||||||
}
|
}
|
||||||
// 个人动作舞
|
// 个人动作舞
|
||||||
function peopleAction(id,actionVal){
|
function peopleAction(id,aevent){
|
||||||
actionTimer = setInterval(()=>{
|
actionArr.forEach((item,index)=>{
|
||||||
actionArr.forEach((item,index)=>{
|
// var chooseIdex = Math.floor(Math.random()*num);
|
||||||
// var chooseIdex = Math.floor(Math.random()*num);
|
var haveDan = $(`.data${id} .people-img`).is(`.${item}`);
|
||||||
var haveDan = $(`.data${id} .people-img`).is(`.${item}`);
|
if(haveDan){
|
||||||
if(haveDan){
|
$(`.data${id} .people-img`).removeClass(item);
|
||||||
$(`.data${id} .people-img`).removeClass(item);
|
$(`.data${id} .people-img`).addClass(aevent);
|
||||||
$(`.data${id} .people-img`).addClass(actionVal);
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
},3000)
|
|
||||||
}
|
}
|
||||||
// 随机位移
|
// 随机位移
|
||||||
function moveEv(id){
|
function moveEv(id){
|
||||||
console.log(id,'9999999');
|
|
||||||
// var odiv = document.getElementById(`${id}`);
|
|
||||||
var typeMove = Math.floor(Math.random()*4);
|
var typeMove = Math.floor(Math.random()*4);
|
||||||
console.log(typeMove,'typeMove');
|
|
||||||
switch (typeMove){
|
switch (typeMove){
|
||||||
case 0:
|
case 0:
|
||||||
upMove(id);
|
upMove(id);
|
||||||
|
@ -166,8 +160,9 @@ function exitEv(id){
|
||||||
// 进入广场
|
// 进入广场
|
||||||
function peopleObj(name,uid,say,action){
|
function peopleObj(name,uid,say,action){
|
||||||
// 开始说话
|
// 开始说话
|
||||||
sayIng(uid);
|
sayIng(peopleId);
|
||||||
randomDancing(uid);
|
// 随机舞
|
||||||
|
randomDancing(peopleId);
|
||||||
let yspHtml = '';
|
let yspHtml = '';
|
||||||
let yspData = [
|
let yspData = [
|
||||||
{
|
{
|
||||||
|
@ -184,7 +179,7 @@ function peopleObj(name,uid,say,action){
|
||||||
]
|
]
|
||||||
$.each(yspData, function (commentIndex, comment) {
|
$.each(yspData, function (commentIndex, comment) {
|
||||||
yspHtml += `
|
yspHtml += `
|
||||||
<div id="${comment.uid}" class="dance-people data${comment.uid}" style="top: ${comment.top}; left: ${comment.left};">
|
<div id="${comment.uid}" class="dance-people data${comment.peopleId}" style="top: ${comment.top}; left: ${comment.left};">
|
||||||
<div class="speak ">${comment.say}</div>
|
<div class="speak ">${comment.say}</div>
|
||||||
<div class="people-img ${comment.peopleImg} ${comment.dancin}">
|
<div class="people-img ${comment.peopleImg} ${comment.dancin}">
|
||||||
<div class="stick ${comment.ying_guang}"></div>
|
<div class="stick ${comment.ying_guang}"></div>
|
||||||
|
|
|
@ -187,8 +187,6 @@ function receiveMessage(event)
|
||||||
$(`#${userId} .speak`).addClass("dn");
|
$(`#${userId} .speak`).addClass("dn");
|
||||||
},3000)
|
},3000)
|
||||||
peopleAction(`${userId}`,dm.event);
|
peopleAction(`${userId}`,dm.event);
|
||||||
// upMove();//上移
|
|
||||||
// downMove();//下移
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
num++;
|
num++;
|
||||||
|
|
Loading…
Reference in New Issue