Set Scene

Draws shapes in the editor or playback scene. Helpful for custom tools and renders. Read more here

Syntax

Actions.setScene(scene, type);

Parameters

scene: Millions.Scene

A WebGL Millions scene to render.

type?: number

The scene to merge, where 0 is edit and 1 is playback. Defaults to edit.

Examples

Draw a rainbow triangle at the origin in the edit scene.

Actions.setScene(
  Millions.Scene.fromEntities([
    new Millions.Triangle(
      {x: 0, y: 0, color: new Millions.Color(255, 0, 0, 255)},
      {x: 10, y: 0, color: new Millions.Color(0, 255, 0, 255)},
      {x: 10, y: 10, color: new Millions.Color(0, 0, 255, 255)},
      1,
      0
    )
  ])
)

Clear the edit scene.

Actions.setScene(new Millions.Scene());