Class: Viewer

ROS2D. Viewer

new Viewer(options)

A Viewer can be used to render an interactive 2D scene to a HTML5 canvas.
Parameters:
Name Type Description
options object with following keys: * divID - the ID of the div to place the viewer in * width - the initial width, in pixels, of the canvas * height - the initial height, in pixels, of the canvas * background (optional) - the color to render the background, like '#efefef'
Source:

Methods

addObject(object)

Add the given createjs object to the global scene in the viewer.
Parameters:
Name Type Description
object the object to add
Source:

scaleToDimensions(width, height)

Scale the scene to fit the given width and height into the current canvas.
Parameters:
Name Type Description
width the width to scale to in meters
height the height to scale to in meters
Source:

shift(x, y)

Shift the main view of the canvas by the given amount. This is based on the ROS coordinate system. That is, Y is opposite that of a traditional canvas.
Parameters:
Name Type Description
x the amount to shift by in the x direction in meters
y the amount to shift by in the y direction in meters
Source: