-
Notifications
You must be signed in to change notification settings - Fork 5
lerp.um
Marek Maskarinec edited this page Sep 14, 2022
·
2 revisions
Simple linear interpolation module.
type Any* = interface{}```
## struct Item*
```go
type Item* = struct {
start, end: th.fu
length: th.uu
progress: th.fu
swap: bool
ctx: Any
callback: fn(ctx: Any)
}
Lerper queue item. It interpolates between start and end for the duration of length in ms. Additionally you can enable swap, which instead of dequeueing swaps start and end and resets the progress.
fn mk*(start, end: th.fu, length: th.uu, swap: bool = false): Item {
Item's constructor
type Lerper* = []Item```
Lerper is a queue of items. It will lerp the first one and if it ends
and doesn't have swap enabled, it will dequeue it.
## fn dequeue*
`fn (l: ^Lerper) dequeue*() {`
Removes the first lerper item.
## fn enqueue*
`fn (l: ^Lerper) enqueue*(i: Item) {`
Adds an item to l's queue
## fn byDelta*
`fn (l: ^Lerper) byDelta*(delta: th.uu): th.fu {`
Interpolates the front by delta. And returns it's value.