350 lines
12 KiB
JavaScript
350 lines
12 KiB
JavaScript
|
|
let SymbL={
|
|
catalog:[
|
|
//front
|
|
{x:0*fs, y:0, z:0, yCopy:0},//0
|
|
{x:100*fs, y:0, z:0, yCopy:0},//1
|
|
{x:100*fs, y:-50*fs, z:0, yCopy:-50*fs},//2
|
|
{x:50*fs, y:-50*fs, z:0, yCopy:-50*fs},//3
|
|
{x:50*fs, y:-200*fs, z:0, yCopy:-200*fs},//4
|
|
{x:0*fs, y:-200*fs, z:0, yCopy:-200*fs},//5
|
|
// Back
|
|
{x:0, y:0, z:50*fs, yCopy:0},//6
|
|
{x:100*fs, y:0, z:50*fs, yCopy:0},//7
|
|
{x:100*fs, y:-50*fs, z:50*fs, yCopy:-50*fs},//8
|
|
{x:50*fs, y:-50*fs, z:50*fs, yCopy:-50*fs},//9
|
|
{x:50*fs, y:-200*fs, z:50*fs, yCopy:-200*fs},//10
|
|
{x:0, y:-200*fs, z:50*fs, yCopy:-200*fs}//11
|
|
],
|
|
path:[
|
|
//front
|
|
{point:0, line:false},
|
|
{point:1, line:true},
|
|
{point:2, line:true},
|
|
{point:3, line:true},
|
|
{point:4, line:true},
|
|
{point:5, line:true},
|
|
{point:0, line:true, f:"#4d4dff"},
|
|
//back
|
|
{point:6, line:false},
|
|
{point:7, line:true},
|
|
{point:8, line:true},
|
|
{point:9, line:true},
|
|
{point:10, line:true},
|
|
{point:11, line:true},
|
|
{point:6, line:true},
|
|
//
|
|
{point:0, line:true},
|
|
{point:7, line:false},
|
|
{point:1, line:true},
|
|
{point:8, line:false},
|
|
{point:2, line:true},
|
|
{point:9, line:false},
|
|
{point:3, line:true},
|
|
{point:10, line:false},
|
|
{point:4, line:true},
|
|
{point:11, line:false},
|
|
{point:5, line:true},
|
|
],
|
|
real:{
|
|
xReal:width/2-500*fs,
|
|
yReal:symbLy,
|
|
zReal:200,
|
|
degXY:0,
|
|
degXZ:0,
|
|
degYZ:0},
|
|
behavior:{
|
|
vx:0,
|
|
vy:0,
|
|
vz:0,
|
|
DXY:0,
|
|
DXZ:rad(rnd(10,20)/10),
|
|
DYZ:0, kadr:0,
|
|
dy:0.2,
|
|
jy:rnd(-15,-10),
|
|
isJump:false,
|
|
time:rnd(50,200)
|
|
},
|
|
nextStep: function(width,height){
|
|
if(!this.behavior.isJump)this.behavior.kadr++;
|
|
this.real.xReal=this.real.xReal+this.behavior.vx;
|
|
this.real.yReal=this.real.yReal+this.behavior.vy;
|
|
this.real.zReal=this.real.zReal+this.behavior.vz;
|
|
this.real.degXY=this.real.degXY+this.behavior.DXY;
|
|
this.real.degXZ=this.real.degXZ+this.behavior.DXZ;
|
|
this.real.degYZ=this.real.degYZ+this.behavior.DYZ;
|
|
if(this.behavior.kadr>this.behavior.time-10){
|
|
for(let i=0; i<this.catalog.length; i++){
|
|
this.catalog[i].y=this.behavior.time===this.behavior.kadr?
|
|
this.catalog[i].yCopy:this.catalog[i].y*0.97
|
|
}
|
|
}
|
|
if(this.behavior.kadr>this.behavior.time){
|
|
this.behavior.kadr=0;
|
|
this.behavior.isJump=true;
|
|
let jump=rnd(-20*hs,-7*hs);
|
|
let somersaults=180/(jump/0.2)
|
|
this.behavior.vy=jump;
|
|
if(jump<-12*hs) this.behavior.DXY=rad(somersaults);
|
|
}
|
|
if(this.real.yReal<=symbLy && this.behavior.isJump){
|
|
this.behavior.vy+=this.behavior.dy
|
|
} else {
|
|
this.behavior.vy=0;
|
|
this.real.yReal=symbLy;
|
|
this.behavior.isJump=false;
|
|
this.behavior.DXY=0;
|
|
this.real.degXY=0;
|
|
}
|
|
}
|
|
}
|
|
|
|
let SymbA1={
|
|
catalog:[
|
|
//front
|
|
{x:0*fs, y:0, z:0, yCopy:0},//0
|
|
{x:50*fs, y:-200*fs, z:0, yCopy:-200*fs},//1
|
|
{x:100*fs, y:0, z:0, yCopy:0},//2
|
|
{x:75*fs, y:0, z:0, yCopy:0},//3
|
|
{x:50*fs, y:-100*fs, z:0, yCopy:-150*fs},//4
|
|
{x:25*fs, y:0, z:0, yCopy:0},//5
|
|
{x:0, y:-25*fs,z:0, yCopy:-25*fs},//6
|
|
{x:100*fs, y:-25*fs, z:0, yCopy:-25*fs},//7
|
|
// Back
|
|
{x:0*fs, y:0, z:50*fs, yCopy:0},//8
|
|
{x:50*fs, y:-200*fs, z:50*fs, yCopy:-200*fs},//9
|
|
{x:100*fs, y:0, z:50*fs, yCopy:0},//10
|
|
{x:75*fs, y:0, z:50*fs, yCopy:0},//11
|
|
{x:50*fs, y:-100*fs, z:50*fs, yCopy:-150*fs},//12
|
|
{x:25*fs, y:0, z:50*fs, yCopy:0},//13
|
|
{x:0, y:-25*fs,z:50*fs, yCopy:-25*fs},//14
|
|
{x:100*fs, y:-25*fs, z:50*fs, yCopy:-25*fs}//15
|
|
],
|
|
path:[
|
|
//front
|
|
{point:0, line:false},
|
|
{point:1, line:true},
|
|
{point:2, line:true},
|
|
{point:3, line:true},
|
|
{point:4, line:true},
|
|
{point:5, line:true},
|
|
{point:0, line:true, f:"#4d4dff"},
|
|
{point:6, line:false},
|
|
{point:7, line:true},
|
|
//back
|
|
{point:8, line:false},
|
|
{point:9, line:true},
|
|
{point:10, line:true},
|
|
{point:11, line:true},
|
|
{point:12, line:true},
|
|
{point:13, line:true},
|
|
{point:8, line:true},
|
|
{point:14, line:false},
|
|
{point:15, line:true},
|
|
// //
|
|
{point:7, line:true},
|
|
{point:0, line:false},
|
|
{point:8, line:true},
|
|
{point:1, line:false},
|
|
{point:9, line:true},
|
|
{point:2, line:false},
|
|
{point:10, line:true},
|
|
{point:3, line:false},
|
|
{point:11, line:true},
|
|
{point:4, line:false},
|
|
{point:12, line:true},
|
|
{point:5, line:false},
|
|
{point:13, line:true},
|
|
{point:6, line:false},
|
|
{point:14, line:true},
|
|
],
|
|
real:{xReal:width/2-200*fs, yReal:symbLy, zReal:200, degXY:0, degXZ:0, degYZ:0},
|
|
behavior:{vx:0, vy:0, vz:0, DXY:0, DXZ:rad(rnd(10,20)/10), DYZ:0, kadr:0, dy:0.2, jy:rnd(-15,-10), isJump:false, time:rnd(100,300)},
|
|
nextStep: function(width,height){
|
|
if(!this.behavior.isJump)this.behavior.kadr++;
|
|
this.real.xReal=this.real.xReal+this.behavior.vx;
|
|
this.real.yReal=this.real.yReal+this.behavior.vy;
|
|
this.real.zReal=this.real.zReal+this.behavior.vz;
|
|
this.real.degXY=this.real.degXY+this.behavior.DXY;
|
|
this.real.degXZ=this.real.degXZ+this.behavior.DXZ;
|
|
this.real.degYZ=this.real.degYZ+this.behavior.DYZ;
|
|
if(this.behavior.kadr>this.behavior.time-10){
|
|
for(let i=0; i<this.catalog.length; i++){
|
|
this.catalog[i].y=this.behavior.time===this.behavior.kadr?
|
|
this.catalog[i].yCopy:this.catalog[i].y*0.97
|
|
}
|
|
}
|
|
if(this.behavior.kadr>this.behavior.time){
|
|
this.behavior.kadr=0;
|
|
this.behavior.isJump=true;
|
|
let jump=rnd(-20*hs,-7*hs);
|
|
let somersaults=180/(jump/0.2)
|
|
this.behavior.vy=jump;
|
|
if(jump<-12*hs) this.behavior.DXY=rad(somersaults);
|
|
}
|
|
if(this.real.yReal<=symbLy && this.behavior.isJump){
|
|
this.behavior.vy+=this.behavior.dy
|
|
} else {
|
|
this.behavior.vy=0;
|
|
this.real.yReal=symbLy;
|
|
this.behavior.isJump=false;
|
|
this.behavior.DXY=0;
|
|
this.real.degXY=0;
|
|
}
|
|
}
|
|
}
|
|
//__________________________________________________________________________________
|
|
let SymbP={
|
|
catalog:[
|
|
//front
|
|
{x:0*fs, y:0, z:0, yCopy:0},//0
|
|
{x:50*fs, y:0, z:0, yCopy:0},//1
|
|
{x:50*fs, y:-100*fs, z:0, yCopy:-100*fs},//2
|
|
{x:75*fs, y:-100*fs, z:0, yCopy:-100*fs},//3
|
|
{x:100*fs, y:-125*fs, z:0, yCopy:-125*fs},//4
|
|
{x:100*fs, y:-175*fs,z:0, yCopy:-175*fs},//5
|
|
{x:75*fs, y:-200*fs, z:0, yCopy:-200*fs},//6
|
|
{x:0, y:-200*fs, z:0, yCopy:-200*fs},//7
|
|
//гайка
|
|
{x:getX(25*fs, 0)+50*fs, y:getY(25*fs,0)-150*fs, z:0, yCopy:getY(25*fs,0)-150*fs},//8
|
|
{x:getX(25*fs,60)+50*fs, y:getY(25*fs,60)-150*fs, z:0, yCopy:getY(25*fs,60)-150*fs},//9
|
|
{x:getX(25*fs,120)+50*fs, y:getY(25*fs,120)-150*fs, z:0, yCopy:getY(25*fs,120)-150*fs},//10
|
|
{x:getX(25*fs,180)+50*fs, y:getY(25*fs,180)-150*fs, z:0, yCopy:getY(25*fs,180)-150*fs},//11
|
|
{x:getX(25*fs,240)+50*fs, y:getY(25*fs,240)-150*fs, z:0, yCopy:getY(25*fs,240)-150*fs},//12
|
|
{x:getX(25*fs,300)+50*fs, y:getY(25*fs,300)-150*fs, z:0, yCopy:getY(25*fs,300)-150*fs},//13
|
|
// Back
|
|
{x:0*fs, y:0, z:50*fs, yCopy:0},//14
|
|
{x:50*fs, y:0, z:50*fs, yCopy:0},//15
|
|
{x:50*fs, y:-100*fs, z:50*fs, yCopy:-100*fs},//16
|
|
{x:75*fs, y:-100*fs, z:50*fs, yCopy:-100*fs},//17
|
|
{x:100*fs, y:-125*fs, z:50*fs, yCopy:-125*fs},//18
|
|
{x:100*fs, y:-175*fs,z:50*fs, yCopy:-175*fs},//19
|
|
{x:75*fs, y:-200*fs, z:50*fs, yCopy:-200*fs},//20
|
|
{x:0, y:-200*fs, z:50*fs, yCopy:-200*fs},//21
|
|
|
|
{x:getX(25*fs, 0)+50*fs, y:getY(25*fs,0)-150*fs, z:50*fs, yCopy:getY(25*fs,0)-150*fs},//22
|
|
{x:getX(25*fs,60)+50*fs, y:getY(25*fs,60)-150*fs, z:50*fs, yCopy:getY(25*fs,60)-150*fs},//23
|
|
{x:getX(25*fs,120)+50*fs, y:getY(25*fs,120)-150*fs, z:50*fs, yCopy:getY(25*fs,120)-150*fs},//24
|
|
{x:getX(25*fs,180)+50*fs, y:getY(25*fs,180)-150*fs, z:50*fs, yCopy:getY(25*fs,180)-150*fs},//25
|
|
{x:getX(25*fs,240)+50*fs, y:getY(25*fs,240)-150*fs, z:50*fs, yCopy:getY(25*fs,240)-150*fs},//26
|
|
{x:getX(25*fs,300)+50*fs, y:getY(25*fs,300)-150*fs, z:50*fs, yCopy:getY(25*fs,300)-150*fs},//27
|
|
],
|
|
path:[
|
|
//front
|
|
{point:0, line:false},
|
|
{point:1, line:true},
|
|
{point:2, line:true},
|
|
{point:3, line:true},
|
|
{point:4, line:true},
|
|
{point:5, line:true},
|
|
{point:6, line:true},
|
|
{point:7, line:true},
|
|
{point:0, line:true, f:"#4d4dff"},
|
|
//гайка
|
|
{point:8, line:false},
|
|
{point:9, line:true},
|
|
{point:10, line:true},
|
|
{point:11, line:true},
|
|
{point:12, line:true},
|
|
{point:13, line:true},
|
|
{point:8, line:true, f:'#07082bff'},
|
|
//back
|
|
{point:14, line:false},
|
|
{point:15, line:true},
|
|
{point:16, line:true},
|
|
{point:17, line:true},
|
|
{point:18, line:true},
|
|
{point:19, line:true},
|
|
{point:20, line:true},
|
|
{point:21, line:true},
|
|
{point:14, line:true},
|
|
|
|
{point:22, line:false},
|
|
{point:23, line:true},
|
|
{point:24, line:true},
|
|
{point:25, line:true},
|
|
{point:26, line:true},
|
|
{point:27, line:true},
|
|
{point:22, line:true },
|
|
// // //
|
|
{point:8, line:true},
|
|
{point:0, line:false},
|
|
{point:14, line:true},
|
|
{point:1, line:false},
|
|
{point:15, line:true},
|
|
{point:2, line:false},
|
|
{point:16, line:true},
|
|
{point:3, line:false},
|
|
{point:17, line:true},
|
|
{point:4, line:false},
|
|
{point:18, line:true},
|
|
{point:5, line:false},
|
|
{point:19, line:true},
|
|
{point:6, line:false},
|
|
{point:20, line:true},
|
|
{point:7, line:false},
|
|
{point:21, line:true},
|
|
{point:8, line:false},
|
|
{point:22, line:true},
|
|
{point:9, line:false},
|
|
{point:23, line:true},
|
|
{point:10, line:false},
|
|
{point:24, line:true},
|
|
{point:11, line:false},
|
|
{point:25, line:true},
|
|
{point:12, line:false},
|
|
{point:26, line:true},
|
|
{point:13, line:false},
|
|
{point:27, line:true},
|
|
],
|
|
real:{xReal:width/2+100*fs, yReal:symbLy, zReal:200, degXY:0, degXZ:0, degYZ:0},
|
|
behavior:{
|
|
vx:0,
|
|
vy:0,
|
|
vz:0,
|
|
DXY:0,
|
|
DXZ:rad(rnd(10,20)/10),
|
|
DYZ:0,
|
|
kadr:0,
|
|
dy:0.2,
|
|
jy:rnd(-15,-10),
|
|
isJump:false,
|
|
time:rnd(100,300)
|
|
},
|
|
nextStep: function(width,height){
|
|
if(!this.behavior.isJump)this.behavior.kadr++;
|
|
this.real.xReal=this.real.xReal+this.behavior.vx;
|
|
this.real.yReal=this.real.yReal+this.behavior.vy;
|
|
this.real.zReal=this.real.zReal+this.behavior.vz;
|
|
this.real.degXY=this.real.degXY+this.behavior.DXY;
|
|
this.real.degXZ=this.real.degXZ+this.behavior.DXZ;
|
|
this.real.degYZ=this.real.degYZ+this.behavior.DYZ;
|
|
if(this.behavior.kadr>this.behavior.time-10){
|
|
for(let i=0; i<this.catalog.length; i++){
|
|
this.catalog[i].y=this.behavior.time===this.behavior.kadr?
|
|
this.catalog[i].yCopy:this.catalog[i].y*0.97
|
|
}
|
|
}
|
|
if(this.behavior.kadr>this.behavior.time){
|
|
this.behavior.kadr=0;
|
|
this.behavior.isJump=true;
|
|
this.behavior.DXY=rad(rnd(1,10)/10);
|
|
this.behavior.vy=rnd(-20*hs,-7*hs);
|
|
}
|
|
if(this.real.yReal<=symbLy && this.behavior.isJump){
|
|
this.behavior.vy+=this.behavior.dy
|
|
} else {
|
|
this.behavior.vy=0;
|
|
this.real.yReal=symbLy;
|
|
this.behavior.isJump=false;
|
|
this.behavior.DXY=0;
|
|
}
|
|
}
|
|
}
|
|
|
|
let SymbA2={};
|
|
SymbA2.catalog=SymbA1.catalog.map(({x,y,z,yCopy})=>{return {x,y,z,yCopy}});
|
|
SymbA2.path=SymbA1.path.map(({point,line,f})=>{return{point,line,f}});
|
|
SymbA2.real={xReal:width/2+400*fs, yReal:symbLy, zReal:200, degXY:0, degXZ:0, degYZ:0}
|
|
SymbA2.behavior={vx:0, vy:0, vz:0, DXY:0, DXZ:rad(rnd(-20,20)/10), DYZ:0, kadr:0, dy:0.2, jy:rnd(-15,-10), isJump:false, time:rnd(100,300)}
|
|
SymbA2.nextStep=SymbA1.nextStep |