Script Module

Script objects are used to control other objects present in the scene.

It can access and change every object in the program and supports some events

  • initialize
    • Called on app initialization, its called after all children elements are initialized, its safe to apply operations on other objects inside this method.
  • update(delta)
    • Called on every frame after rendering
  • dispose
    • Called when disposing the program
  • onMouseOver(intersections)
    • Called on every frame if mouse is on top of one of the script children
    • Receives an intersections array as argument.
  • onResize(x, y)
    • Called every time the window is resized
    • Receives width and height as parameters
  • onAppData(data)
    • Called when receiving data sent by the host website

Code written inside scripts have access to the following attributes:

  • scene
  • program
  • self
    • Same as this reference but global in the script scope
  • Keyboard
  • Mouse

There is also access to the following functions

  • include
    • Include a javascript file from resources, when including files the user needs to be carefull and clear manually global declarations

This namespace provides the following classes: