whs.js/docs/data/Hello World!.md
panaweec 7819458ac2 Update link in Document
Former-commit-id: 0cfe1883132c7cd324caa1aa5e871635ace007dc
2017-10-28 03:49:28 +07:00

1.7 KiB

Basic scene

To create whitestorm.js app you should make a basic HTML document with html, head and body tags. Next step is to include Whitestorm.js to the document and main app script file. You can do it simply using script tag.

Try this helloworld demo online.

App

The first thing you should setup is the App object. When you do this, you do multiple things at once:

  • Setup THREE.Scene
  • Make a perspective camera and add it to the scene.
  • Apply background and other renderer options.
  • Set auto resize (in addition).
const app = new WHS.App([
  new WHS.ElementModule(),
  new WHS.SceneModule(),

  new WHS.DefineModule('camera', new WHS.PerspectiveCamera({
    position: new THREE.Vector3(0, 0, 50)
  })),

  new WHS.RenderingModule({bgColor: 0x162129}),
  new WHS.ResizeModule()
]);

> Loops & 3D Animation

FAQ

Q: Why is the color in Hexadecimal format?

A: Simply following Three.js' best practice.