当前位置:网站首页>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",
}
];
边栏推荐
- Lecture 4: Longest ascending substring
- 汉字风格迁移篇---对抗性区分域适应(L1)Adversarial Discriminative Domain Adaptation
- Dynamic programming - stock trading 5
- 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]
- Differences among CPU, GPU and NPU
- 架构——MVC的升华
- 巨形象的图解 SQL
- 【医疗行业】DICOM converter Tools
- Slam overview Reading Note 7: visual and visual intangible slam: state of the art, classification, and empirical 2021
- SkyWalking分布式系统应用程序性能监控工具-中
猜你喜欢
随机推荐
Ten thousand words detailed Google play online application standard package format AAB
JS epidemic at home, learning can't stop, 7000 word long text to help you thoroughly understand the prototype and prototype chain
炒黄金开户平台有没有正规,安全的
Skywalking distributed system application performance monitoring tool - medium
What if win11 wallpaper turns black? The solution of win11 wallpaper blackening
【科普】精度和分辨率的区别与联系
Chinese character style transfer --- antagonistic discriminative domain adaptation (L1)
C language layered understanding (C language array)
User question understanding and answer content organization for epidemic disease Science Popularization
aac 和 h264等的时间戳
Hard deduction SQL statement exercises, wrong question records
If we were the developer responsible for repairing the collapse of station B that night
Document translation__ Tvreg V2: variational imaging method for denoising, deconvolution, repair and segmentation (part)
进程间通信
@Repository详解
Simple encapsulation steps of request data request of uniapp
Slam overview Reading Note 6: slam research based on image semantics: application-oriented solutions for autonomous navigation of mobile robots 2020
自动化配置SSH免密登录和取消SSH免密配置脚本
Redis
uniapp的request数据请求简单封装步骤









