Class Viewport2D

Class Hierarchy

Use a Viewport 2D to set the size of a render target surface onto which content is projected. Viewport 2D is a 2D node that can project a 3D scene through a camera. Viewport 2D is a special node because it can render both 2D nodes, such as Image, Page, Button 2D, and a Scene, which is a 3D node.

When you create a new project in Kanzi Studio, that project has a Viewport 2D with a Scene that contains a Camera and a Directional Light. However, when you create a Viewport 2D using the API you have to manually add the Scene and any contents of the Scene.

Inherits properties and message types from Viewport2DMetadata.

Synopsis

Methods
create()

Creates a Viewport2D node

create1()

Creates a Viewport2D node

createDefault()

Creates a Viewport2D node

createDefault1()

Creates a Viewport2D node

Viewport2D.Viewport2D:create(name)

Creates a Viewport2D node.

The viewport is created without a scene.

Parameters
name (string)

Node name.

Viewport2D.Viewport2D:create1(name, width, height)

Creates a Viewport2D node.

The viewport is created without a scene.

Parameters
name (string)

Node name.

width (number)

Node width.

height (number)

Node height.

Viewport2D.Viewport2D:createDefault(name)

Creates a Viewport2D node.

A scene is created at the same time.

Parameters
name (string)

Node name.

Viewport2D.Viewport2D:createDefault1(name, width, height)

Creates a Viewport2D node.

A scene is created at the same time.

Parameters
name (string)

Node name.

width (number)

Node width.

height (number)

Node height.