mirror of
https://github.com/WhitestormJS/whs.js.git
synced 2025-12-08 20:26:23 +00:00
1.7 KiB
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()
]);
FAQ
Q: Why is the color in Hexadecimal format?
A: Simply following Three.js' best practice.