Pass layer and state name into dynamic state properties

Also changes the context of the executed function to the layer.
This makes it possible to do things like:

```
# this adds a state called "a" for every layer that moves the layer 200px up from its current position
for layer in [layer1, layer2]
  layer.states.add 'a', y: -> @y - 200
```

or, if not relying on `this`:

```
for layer in [layer1, layer2]
  layer.states.add 'a', y: (l) -> l.y - 200
```