Added some more examples to README.md

This commit is contained in:
rxi 2014-03-02 20:59:32 +00:00
parent fbe585fc85
commit d344b9d04e

View File

@ -28,6 +28,9 @@ Returns `1` if `x` is 0 or above, returns `-1` when `x` is negative.
### lume.lerp(a, b, amount) ### lume.lerp(a, b, amount)
Returns the linearly interpolated value between `a` and `b`, `amount` should be Returns the linearly interpolated value between `a` and `b`, `amount` should be
range of 0 - 1; if `amount` is outside of this range it is clamped. range of 0 - 1; if `amount` is outside of this range it is clamped.
```lua
lume.lerp(100, 200, .5) -- Returns 150
```
### lume.smooth(a, b, amount) ### lume.smooth(a, b, amount)
Similar to `lume.lerp()` but uses cosine interpolation instead of linear Similar to `lume.lerp()` but uses cosine interpolation instead of linear
@ -49,6 +52,9 @@ between `0` and `1` is returned.
### lume.randomchoice(t) ### lume.randomchoice(t)
Returns a random value from array `t`. Returns a random value from array `t`.
```lua
lume.randomchoice({true, false}) -- Returns either true or false
```
### lume.shuffle(t) ### lume.shuffle(t)
Shuffles the values of array `t` in place, returns the array. Shuffles the values of array `t` in place, returns the array.