> For the complete documentation index, see [llms.txt](https://enls.gitbook.io/rgss-reference-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enls.gitbook.io/rgss-reference-manual/game-library/rgss-built-in-classes/viewport.md).

# Viewport

The viewport class. Used when displaying sprites in one portion of the screen, with no overflow into other regions.

## Superclass

* [Object](/rgss-reference-manual/standard-library/built-in-classes/object.md)

## Class Methods

### Viewport.new(*x, y, width, height*)

### Viewport.new(*rect*)

Creates a viewport object.

## Methods

### dispose

Frees the viewport. If the viewport has already been freed, does nothing.

### disposed?

Returns TRUE if the viewport has been freed.

### flash(*color, duration*)

Begins flashing the viewport. duration specifies the number of frames the flash will last.

If color is set to nil, the viewport will disappear while flashing.

### update

Refreshes the viewport flash. As a rule, this method is called once per frame.

It is not necessary to call this method if no flash effect is needed.

## Properties

### rect

The box ([Rect](/rgss-reference-manual/game-library/rgss-built-in-classes/rect.md)) defining the viewport.

### visible

The viewport's visibility. If TRUE, the viewport is visible.

### z

The viewport's Z-coordinate. The larger this value, the closer to the player the viewport will be displayed. If multiple objects share the same Z-coordinate, the more recently created object will be displayed closest to the player.

### ox

The X-coordinate of the viewport's starting point. Change this value to shake the screen, etc.

### oy

The Y-coordinate of the viewport's starting point. Change this value to shake the screen, etc.

### color

The color ([Color](/rgss-reference-manual/game-library/rgss-built-in-classes/color.md)) to be blended with the viewport. Alpha values are used in the blending ratio.

Handled separately from the color blended into a [flash](#flash-color-duration) effect.

### tone

The viewport's color tone ([Tone](/rgss-reference-manual/game-library/rgss-built-in-classes/tone.md)).
