All examples · Scenes

Scene from a document

What this example shows

The same room twice: on the left built from a JSON document with sceneFromDoc, on the right written by hand. They draw the same thing, and that is the whole claim the format makes.

sceneFromDoc gives back an ordinary scene function: from that point nothing in the engine knows where it came from, so starting it, changing to it, covering that change with a transition and pausing it are not features the format had to add. And because its body calls the same createSprite you would have called, the format cannot express anything the engine's API cannot build.

Starting