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