当前位置:网站首页>An example of building 3D effects on the web based on three.js
An example of building 3D effects on the web based on three.js
2022-07-27 14:49:00 【11eleven】
web Available on page 3D effect , Can provide a lot of colors for the page ,H5 after canvas by webgl Provides the foundation , Make in web Page using JS Can also write 3D The effect of , among three.js As an encapsulated graphic function Framework , Convenient for getting started , The renderings are as follows .



These are three of the official examples , Friends who haven't been in touch will definitely feel very magical , in fact three.js There is much more to be done , It's easy to get started , If it is flexibly applied to the project, we can only see their respective play .
The following is the effect of a project made by myself

Map JSON as follows , I encapsulated the package generated by the indoor wall , I'll explain it in detail later when I'm free .
var zallMap2 = [
{
title: '',
floorType:floorTypes[1],
x: 0,
y: 80,
z: 0,
width: 962,
height: 866,
color: "#142B46",
textcolor: "black",
bordercolor: "rgba(76, 181, 216, 0.85)",
imageurl: 'images/Escalator.png',
},
{
title: '',
x: 480,
y: 80,
z: 0,
width: 2,
height: 866,
color: "#30B2BB",
textcolor: "black",
bordercolor: "rgba(76, 181, 216, 0.85)",
bspMesh: [
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 82,
width: 38,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 17,
width: 2,
height: 73.7,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 120,
width: 38,
height: 5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 187.5,
width: 2,
height: 106.5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 213,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 26.5,
y: 80,
z: 213,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 270,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 26.5,
y: 80,
z: 270,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 270,
width: 2,
height: 92,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 360,
width: 36,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 360,
width: 2,
height: 59,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 402,
width: 17,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 66,
y: 80,
z: 402,
width: 2,
height: 30,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 431,
width: 2,
height: 18,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 462,
width: 36,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 461,
width: 2,
height: 69,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 525,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 26.5,
y: 80,
z: 525,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 648,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 26.5,
y: 80,
z: 648,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 648,
width: 2,
height: 106.5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 738,
width: 36,
height: 5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 0,
y: 80,
z: 779,
width: 36,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 36,
y: 80,
z: 772,
width: 2,
height: 73.5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 17,
width: 2,
height: 73.5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 82,
width: 38,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 108.5,
width: 2,
height: 106.5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 120,
width: 38,
height: 5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 213,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 950.5,
y: 80,
z: 213,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 269,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 950.5,
y: 80,
z: 269,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 269,
width: 2,
height: 149,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 359,
width: 38,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 909,
y: 80,
z: 401,
width: 17,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 896,
y: 80,
z: 401,
width: 2,
height: 30,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 430,
width: 2,
height: 18,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 460,
width: 38,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 459,
width: 2,
height: 69,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 526,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 950.5,
y: 80,
z: 526,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 649,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 950.5,
y: 80,
z: 649,
width: 11.5,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 649,
width: 2,
height: 106.5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 739,
width: 38,
height: 5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 773.5,
width: 2,
height: 73.5,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 924,
y: 80,
z: 780,
width: 38,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 400,
y: 80,
z: 0,
width: 2,
height: 42,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 400,
y: 80,
z: 40,
width: 172,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 570,
y: 80,
z: 0,
width: 2,
height: 42,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 400,
y: 80,
z: 824,
width: 2,
height: 42,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 400,
y: 80,
z: 824,
width: 172,
height: 2,
positionY: 0,
},
{
type: 'union',
geometryType: 'box', color: '#fff',
x: 570,
y: 80,
z: 824,
width: 2,
height: 42,
positionY: 0,
},
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 480,
y: 80,
z: 141.5,
width: 2,
height: 37.6,
positionY: 0,
},
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 480,
y: 80,
z: 374.2,
width: 2,
height: 37.6,
positionY: 0,
},
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 480,
y: 80,
z: 454.6,
width: 2,
height: 37.6,
positionY: 0,
},
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 480,
y: 80,
z: 686,
width: 2,
height: 45,
positionY: 0,
}]
},
{
title: '',
x: 0,
y: 80,
z: 432,
width: 962,
height: 2,
color: "#30B2BB",
textcolor: "black",
bordercolor: "rgba(76, 181, 216, 0.85)",
bspMesh: [
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 72.8,
y: 80,
z: 432,
width: 37.8,
height: 2,
positionY: 0,
},
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 420,
y: 80,
z: 432,
width: 37.5,
height: 2,
positionY: 0,
},
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 502.5,
y: 80,
z: 432,
width: 37.5,
height: 2,
positionY: 0,
}
,
{
type: 'subtract',// door
geometryType: 'box', color: '#fff',
x: 848,
y: 80,
z: 432,
width: 40,
height: 2,
positionY: 0,
}
]
},
{
title: '',//wall North wall on the first floor
x: 0,
y: 80,
z: 0,
width: 962,
height: 2,
color: "#30B2BB",
textcolor: "black",
},
{
title: '',//wall In the west
x: 0,
y: 80,
z: 2,
width: 2,
height: 864,
color: "#30B2BB",
textcolor: "black",
}
,
{
title: '',//wall In the east
x: 960,
y: 80,
z: 0,
width: 2,
height: 864,
color: "#30B2BB",
textcolor: "black",
}
,
{
title: '',//wall south
x: 0,
y: 80,
z: 864,
width: 962,
height: 2,
color: "#30B2BB",
textcolor: "black",
}
];
边栏推荐
- Nokia's patent business was hit for the first time, and Chinese enterprises are not so easy to knead
- How to solve cache avalanche, breakdown and penetration problems
- JS什么是声明提前?函数与变量声明提前的先后顺序(执行上下文铺垫篇)
- 力扣SQL语句习题,错题记录
- 网上券商APP开户安全有保障吗?
- < C> C language hash table usage
- Summary of basic knowledge of C language
- The interviewer asked: how to judge whether an element is in the visible area?
- Why is there no unified quotation for third-party testing fees of software products?
- 自动化配置SSH免密登录和取消SSH免密配置脚本
猜你喜欢

Automatically configure SSH password free login and cancel SSH password free configuration script

FPGA时序约束分享04_output delay 约束
![[popular science] the difference and connection between accuracy and resolution](/img/12/efcce1f6b8801d8d8b08b79818632c.png)
[popular science] the difference and connection between accuracy and resolution

线程知识总结

STM32——电容触摸按键实验

Ten thousand words detailed Google play online application standard package format AAB

Arduino+ze08-ch2o formaldehyde module, output formaldehyde content

JS what is declaration in advance? The order of function and variable declaration in advance (the foreshadowing of execution context)

自动化配置SSH免密登录和取消SSH免密配置脚本

Chinese character style transfer --- antagonistic discriminative domain adaptation (L1)
随机推荐
codeforces 1708E - DFS Trees
Slam overview Reading Note 6: slam research based on image semantics: application-oriented solutions for autonomous navigation of mobile robots 2020
Lecture 4: Longest ascending substring
[intensive reading of papers] grounded language image pre training (glip)
Graphic SQL of giant image
How to deploy open source Siyuan privately
Web页面table表格,实现快速筛选
2022年中国网络视频市场年度综合分析
What if win11 wallpaper turns black? The solution of win11 wallpaper blackening
基于GEC6818开发板的相册
The difference between [x for X in list_a if not np.isnan (x)] and [x if not np.isnan (x) else none for X in list_a]
Construction and empirical research of post talent demand analysis framework based on recruitment advertisement
如果我们是那晚负责修复 B 站崩了的开发人员
正向代理与反向代理
在Oracle VirtualBox中导入Kali Linux官方制作的虚拟机
Redis
"Game engine light in light out" 4.1 unity shader and OpenGL shader
HDU4565 So Easy! [matrix multiplication] [derivation]
Disk troubleshooting of kubernetes node
Slam overview Reading Note 7: visual and visual intangible slam: state of the art, classification, and empirical 2021