# `Cauldron2D.Parallax.Layer`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_2d/lib/cauldron_2d/parallax/layer.ex#L1)

One depth of a parallax background.

    Cauldron2D.Parallax.Layer.new(
      name: :mountains,
      cell: Cauldron2D.Parallax.Strip.cells(rows, wrap: :x),
      factor: {0.25, 0.1},
      drift: {-0.4, 0.0}
    )

`factor` is the share of the camera's distance from `origin` the layer moves: `1.0` moves
with the world, `0.0` is pinned, above `1.0` is nearer than the world. `drift` is tiles a
second the layer moves on its own, through the same arithmetic as `factor`.

`movers` and `volumes` are in the layer's own tiles, either a list or a function of the
layer's visible rectangle, `{{origin_x, origin_y}, {columns, rows}}`.

`void` decides what an empty tile is: `:transparent` lets the layers behind show through,
`:opaque` fills with the atlas's void colour, which is what the backmost layer wants.

`front: true` puts the layer over the world rather than behind it. `animated: true` lets
art with frames animate, redrawn `fps` times a second. `cache: false` redraws the layer
every frame, which a layer whose movers move needs.

# `mover`

```elixir
@type mover() ::
  {term(), {number(), number()}} | {term(), {number(), number()}, number()}
```

# `pair`

```elixir
@type pair() :: {float(), float()}
```

# `rect`

```elixir
@type rect() :: {{integer(), integer()}, {pos_integer(), pos_integer()}}
```

# `t`

```elixir
@type t() :: %Cauldron2D.Parallax.Layer{
  animated: boolean(),
  bands: Cauldron2D.Parallax.Bands.t() | nil,
  cache: boolean(),
  cell: ({integer(), integer()} -&gt; term()),
  drift: pair(),
  factor: pair(),
  fps: pos_integer(),
  front: boolean(),
  movers: [mover()] | (rect() -&gt; [mover()]),
  name: atom(),
  origin: pair(),
  picture: map() | nil,
  void: :transparent | :opaque,
  volumes: list() | (rect() -&gt; list())
}
```

# `focus`

```elixir
@spec focus(t(), {number(), number()}, number()) :: pair()
```

Where this layer is looked at from, for a world focus and a time in milliseconds.

# `movers`

```elixir
@spec movers(t(), rect()) :: [mover()]
```

The layer's movers for a visible rectangle.

# `new`

```elixir
@spec new(keyword()) :: t()
```

A layer from `opts`, which must give `:name` and `:cell`.

# `volumes`

```elixir
@spec volumes(t(), rect()) :: list()
```

The layer's volumes for a visible rectangle.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
