# InputFrame

Class · category: Input

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/extras/input/input.js#L110

Represents an input frame, which contains a map of input deltas. The keys and lengths are fixed
by the object passed to the constructor, for example `{ move: [0, 0, 0], rotate: [0, 0, 0] }`,
and [read](https://api.playcanvas.com/engine/classes/InputFrame.md#read) flushes every delta at once. A frame is the unit of exchange in this input
system: [InputSource](https://api.playcanvas.com/engine/classes/InputSource.md)s are frames that fill themselves from a device, and an application
combines their values into a frame with the shape an [InputController](https://api.playcanvas.com/engine/classes/InputController.md) expects.

**template** The shape of the input frame.

## Constructors

### constructor

```ts
new InputFrame<T extends Record<string, number[]>>(data: T)
```

**Parameters**

- `data` ([`T`](https://api.playcanvas.com/engine/classes/InputFrame.md#t)): The input frame data, where each key corresponds to an input delta.

## Properties

### deltas

```ts
deltas: { [K in string | number | symbol]: InputDelta }
```

## Methods

### read

```ts
read(): { [K in string | number | symbol]: number[] }
```

Returns the current frame state and resets the deltas to zero.

**Returns** `{ [K in string | number | symbol]: number[] }`: - The flushed input frame with current deltas.
