官术网_书友最值得收藏!

Let's code!

Because Three.js runs in web browsers, it can run on—and be developed on—many different platforms. In fact, we're going to build our first Three.js project directly in a browser!

Open up http://mrdoob.com/projects/htmleditor/. You should see HTML and JavaScript code overlaid on top of a spinning sphere-like shape, as shown in the following screenshot:

The online Three.js editor

This is the Hello, World program of Three.js—the minimum code required to get a spinning shape rendering in the browser. The preview will automatically update when you change any code, so go ahead and play with it and see what happens. For example, try changing THREE.MeshBasicMaterial to THREE.MeshNormalMaterial. What happens if you change IcosahedronGeometry to TorusKnotGeometry? Try fiddling with some numbers. Can you make the shape rotate faster or slower?

主站蜘蛛池模板: 高邑县| 长沙市| 云梦县| 东莞市| 潼关县| 独山县| 百色市| 洪湖市| 渝北区| 获嘉县| 达拉特旗| 合肥市| 房山区| 开江县| 红安县| 安西县| 栖霞市| 大姚县| 汤阴县| 裕民县| 宁乡县| 乌什县| 隆安县| 新郑市| 柞水县| 禄劝| 化德县| 兰溪市| 武宣县| 会宁县| 浙江省| 诏安县| 兴海县| 额敏县| 兰坪| 沁源县| 扎兰屯市| 汝州市| 渭南市| 汕头市| 弋阳县|