2019-11-24 18:15:44 +00:00
|
|
|
## A Brief Tour of dyna3
|
|
|
|
|
|
|
|
When you load dyna3, you should initially see a three-dimensional coordinate system with labeled axes.
|
|
|
|
```javascript
|
|
|
|
|
|
|
|
import {threeLoaded, three as J3} from './externals.js'
|
|
|
|
|
|
|
|
main = () ->
|
2019-12-09 04:22:52 +00:00
|
|
|
renderer = new J3.WebGLRenderer()
|
|
|
|
rwd = window.innerWidth
|
|
|
|
rht = window.innerHeight
|
|
|
|
renderer.setSize(rwd, rht)
|
|
|
|
document.body.appendChild renderer.domElement
|
2019-11-24 18:15:44 +00:00
|
|
|
|
2019-12-09 04:22:52 +00:00
|
|
|
scene = new J3.Scene()
|
|
|
|
geometry = new J3.SphereBufferGeometry(1, 5, 5)
|
2019-12-09 17:08:05 +00:00
|
|
|
material = new J3.MeshBasicMaterial {color: 0xff00ff}
|
2019-12-09 04:22:52 +00:00
|
|
|
ball = new J3.Mesh(geometry, material)
|
|
|
|
scene.add ball
|
2019-11-24 18:15:44 +00:00
|
|
|
|
2019-12-09 04:22:52 +00:00
|
|
|
camera = new J3.PerspectiveCamera(75, rwd/rht, 0.1, 1000)
|
|
|
|
camera.position.z = 5
|
2019-11-24 18:15:44 +00:00
|
|
|
|
2019-12-09 04:22:52 +00:00
|
|
|
renderer.render(scene, camera)
|
2019-11-24 18:15:44 +00:00
|
|
|
|
|
|
|
threeLoaded.then(main)
|
|
|
|
```
|