Chapter 00Introduction

What’s in This Book

This book is for those that are new to the Babylon.js (BJS) library and for those that are looking for a better understanding of how to use the Babylon.js API. Throughout the book we assume the reader has a thorough understanding of HTML and CSS, and JavaScript.

In the chapters that follow, we demonstrate the various objects and methods in the library’s API. When doing so, we provide links to the official BJS API documentation, discuss how to use the objects and methods, provide code examples, and give explanations for those examples.

The code is provided in interactive sandboxes like the one shown below.

<script>
  function handler() {
      let node = document.getElementById('name')
      node.innerHTML = 'Got it!'
  }
</script>

<style>
  button {
      background-color: lightblue;
      border-radius: 10px;
  }
</style>

<div id='name'>Hello World!</div>
<button onclick='handler()'>Press me</button>

A sandbox consists of a CodeMirror editor, a menu, and a rendering area. In the example, above the editor is hidden. To make the editor visible, simply press the button in the menu. To close the editor, press the button.

Since it is impossible to illustrate every possible use of the numerous objects and methods in BJS, the reader is encouraged to experiment with the code. When doing so, you’ll notice that if you make a change to the code in the editor, the result is not immediately reflected in the rendering area. To see the result of your changes, you must rerender the code by pressing the button in the editor’s menu. To reset the code to the original code that we provide, press the button.

Online BSJ Resources