# rmp::behavior::Parallax

> A background layer that scrolls at its own factor and repeats itself with no seam.

Source: https://omardev29.github.io/rmp-docs/reference/behaviors/Parallax.html

behavior `#include <rmp/behavior.h>` [include/rmp/behavior.h:352](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L352-L372)

struct Parallax

A background layer that scrolls at its own factor and repeats itself with no seam. Twenty lines everybody writes wrong the first time: the texture has to be drawn TWICE with the offset taken modulo its width, and it has to be recomputed when the window changes size.

Added to an object with `add<rmp::behavior::Parallax>()`; the framework calls its `_ready`, `_draw`, `_update` with the object it is on.

## Fields

| Field | Type | Default | What it is |
|---|---|---|---|
| `texture` | `std::string` |  | A name for [`rmp::assets::load_texture`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-assets.html#load_texture) |
| `factor` | `float` | `0.5f` | 1 = scrolls with the world, 0 = pinned to the screen |
| `speed` | `float` | `0` | Units per second of its own, for a sky that drifts |
| `y` | `float` | `0` | Where the top of the strip sits |
| `tint` | `Color` | `WHITE` | Multiplies the texture's colours; WHITE = drawn as it is |
| `ours` | `struct { … }` |  | What it is keeping track of. Readable, because sometimes you want it; not yours to write. It is one PUBLIC member and not a private block because a struct with a private member is not an aggregate in C++20, and then `{ .speed = 320 }` stops compiling — which is the whole design. The name is the fence. |
