WhitestormJS Framework

Loops & 3D Animation

You don't need to write animate() function like you do in Three.js. The problem is that bigger you app become, the bigger your animate() function is.

Here comes WHS.Loop class. With just a few lines of code you can your own mini-animate() function:

const app = new WHS.App([
  // ...
]);

new WHS.Loop(() => {
  box.rotation.y += 0.02;
}).start(app);

And you can make loop temporary like that:

const loop = new WHS.Loop((clock) => {
  // ...
  if (clock.getElapsedTime() > 5) loop.stop(app);
});

loop.start(app);

This loop will be destroyed after 5 seconds.

Loops & 3D Animation


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.