用户:
烤乳鸽RoastedSquab查看:7 回复:5 评论:7 创建时间:2020-06-10T09:56:54
—————————————————————————————————————————————————————————————————————————————————————————————————
记得礼貌拿代码,别忘记给我作品点赞![]()
第一步一定是做一个火车模型并加标签了~
然后,我们需要一个触发的条件,这里就已开始为触发条件
(async function(){
然后必须要重复执行,不然动不了太长时间
while (true) {
然后*****(保密
)
别打了!我告诉你们! 让火车向前需要设置加速度
for(let i=0;i<15;i++){//火车向前加速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z+=0.1; })
然后保持47秒
await sleep(20) } await sleep(4500)//行驶中
再减速
for(let i=0;i<15;i++){//火车向前减速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z-=0.1;
})
await sleep(20) }
到站了~
await sleep(6000)//停站中
回去用脚吧~
不要打了,告诉你们!
for(let i=0;i<15;i++){//火车向后加速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z-=0.1;
})
await sleep(20) }
await sleep(4500)//行驶中
for(let i=0;i<15;i++){//火车向后减速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z+=0.1;
}) await sleep(20) }
await sleep(6000)//停站中 } })();
然后就是粒子效果
world.querySelectorAll('.gb2').forEach((p) => {
Object.assign(p, {
particleRate: 220,
particleSize: [2, 2, 2, 2, 2],
particleColor: [
new Box3RGBColor(50, 50, 50),
new Box3RGBColor(5, 0.25, 0.1),
new Box3RGBColor(3, 0.05, 0.05),
new Box3RGBColor(0, 0, 0),
new Box3RGBColor(0, 0, 0), ],
particleLifetime: 1,
particleVelocitySpread: new Box3Vector3(2, 2, 2), }); });
合起来~
(async function(){ while (true) { for(let i=0;i<15;i++){//火车向前加速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z+=0.1; }) await sleep(20) } await sleep(4500)//行驶中 for(let i=0;i<15;i++){//火车向前减速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z-=0.1; }) await sleep(20) } await sleep(6000)//停站中 for(let i=0;i<15;i++){//火车向后加速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z-=0.1; }) await sleep(20) } await sleep(4500)//行驶中 for(let i=0;i<15;i++){//火车向后减速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z+=0.1; }) await sleep(20) } await sleep(6000)//停站中 } })(); world.querySelectorAll('.gb2').forEach((p) => { Object.assign(p, { particleRate: 220, particleSize: [2, 2, 2, 2, 2], particleColor: [ new Box3RGBColor(50, 50, 50), new Box3RGBColor(5, 0.25, 0.1), new Box3RGBColor(3, 0.05, 0.05), new Box3RGBColor(0, 0, 0), new Box3RGBColor(0, 0, 0), ], particleLifetime: 1, particleVelocitySpread: new Box3Vector3(2, 2, 2), }); });
记得礼貌拿代码,别忘记给我作品点赞![]()
我叫zzt for(let i=0;i<15;i++){//火车向前加速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z+=0.1; })
然后保持47秒
await sleep(20) } await sleep(4500)//行驶中
再减速
for(let i=0;i<15;i++){//火车向前减速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z-=0.1;
})
await sleep(20) }
到站了~
await sleep(6000)//停站中
回去用脚吧~
不要打了,告诉你们!
for(let i=0;i<15;i++){//火车向后加速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z-=0.1;
})
await sleep(20) }
await sleep(4500)//行驶中
for(let i=0;i<15;i++){//火车向后减速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z+=0.1;
}) await sleep(20) }
await sleep(6000)//停站中 } })();
然后就是粒子效果
world.querySelectorAll('.gb2').forEach((p) => {
Object.assign(p, {
particleRate: 220,
particleSize: [2, 2, 2, 2, 2],
particleColor: [
new Box3RGBColor(50, 50, 50),
new Box3RGBColor(5, 0.25, 0.1),
new Box3RGBColor(3, 0.05, 0.05),
new Box3RGBColor(0, 0, 0),
new Box3RGBColor(0, 0, 0), ],
particleLifetime: 1,
particleVelocitySpread: new Box3Vector3(2, 2, 2), }); });
合起来~
(async function(){ while (true) { for(let i=0;i<15;i++){//火车向前加速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z+=0.1; }) await sleep(20) } await sleep(4500)//行驶中 for(let i=0;i<15;i++){//火车向前减速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z-=0.1; }) await sleep(20) } await sleep(6000)//停站中 for(let i=0;i<15;i++){//火车向后加速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z-=0.1; }) await sleep(20) } await sleep(4500)//行驶中 for(let i=0;i<15;i++){//火车向后减速 world.querySelectorAll(".gb2").forEach((entity)=>{ entity.velocity.z+=0.1; }) await sleep(20) } await sleep(6000)//停站中 } })(); world.querySelectorAll('.gb2').forEach((p) => { Object.assign(p, { particleRate: 220, particleSize: [2, 2, 2, 2, 2], particleColor: [ new Box3RGBColor(50, 50, 50), new Box3RGBColor(5, 0.25, 0.1), new Box3RGBColor(3, 0.05, 0.05), new Box3RGBColor(0, 0, 0), new Box3RGBColor(0, 0, 0), ], particleLifetime: 1, particleVelocitySpread: new Box3Vector3(2, 2, 2), }); }); 点赞0
评论
(async function(){
while (true) {
for(let i=0;i<15;i++){//火车向前加速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z-=0.07;
})
await sleep(120)
}
await sleep(4500)//行驶中
for(let i=0;i<15;i++){//火车向前减速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z+=0.07;
})
await sleep(120)
}
await sleep(3000)//停站中
for(let i=0;i<15;i++){//火车向后加速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z+=0.07;
})
await sleep(120)
}
await sleep(4500)//行驶中
for(let i=0;i<15;i++){//火车向后减速
world.querySelectorAll(".gb2").forEach((entity)=>{
entity.velocity.z-=0.07;
})
await sleep(120)
}
await sleep(3000)//停站中
} })();
world.querySelectorAll('.gb2').forEach((p) => {
Object.assign(p, {
particleRate: 1000,
particleSize: [10, 12, 14, 18, 20],
particleColor: [
new Box3RGBColor(10, 9, 2),
new Box3RGBColor(5, 0.25, 0.1),
new Box3RGBColor(3, 0.05, 0.05),
new Box3RGBColor(0, 0, 0),
new Box3RGBColor(0, 0, 0),
],
particleLifetime: 10,
particleVelocitySpread: new Box3Vector3(2, 2, 2),
});
});
//此代码实现了火车着火的特效点赞0
评论