参考资料:WebGL
html部分
three.min.js可以通过cdn引入,或者通过three.js引入,复制出来放进three.min.js文件中(我用的第二种方式,第一种也能用)
***详细注释都在代码中写了 ***
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>3D魔方</title>
<!-- <script src="https://cdn.bootcdn.net/ajax/libs/three.js/0.156.1/three.min.js"></script> -->
<script src="three.min.js" defer></script>
<script src="script.js" defer