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

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?

主站蜘蛛池模板: 福鼎市| 孟村| 建平县| 忻州市| 台南县| 建瓯市| 安仁县| 丽江市| 会理县| 金塔县| 河间市| 安岳县| 江达县| 庆阳市| 溆浦县| 盐边县| 广水市| 信阳市| 子长县| 都江堰市| 大悟县| 姜堰市| 滕州市| 滦平县| 彝良县| 兰考县| 满洲里市| 锡林浩特市| 定州市| 彰化县| 封丘县| 凤庆县| 准格尔旗| 江北区| 从江县| 沁水县| 肥城市| 万安县| 大竹县| 南通市| 九寨沟县|