iter/lerp
A LerpValue provides a number between two numbers. The stepping function can be linear or another easing.
v = Value(1, 100)
v.get(.5) -> ~50
v = Value(1, 100, cubicSmooth)
v.get(.7) -> ~90
v.get(.9) -> ~99
Stepping over time may need a tick step function
v = Value(1, 100)
v.deltaFrom = stage.clock.tick
v.step(delta=14ms)
// somehow flag 1sec of 60fps?
v.get()
v.get()
v.get()
Divisor Values accept an A, B and a splitting V
Value(0, 1, 100)
v.get(.5) -> .05
v=Value(100, 600, quadEaseInOut)
===
This could be used for time, by providing to dates and calulating the distance between an expected time, and a smoothed time.
// 2 seconds
v = Value(+Date, +Date+2000)
v.step(.7) // should be at seconds location.
v = Value(+Date, +Date+2000, quinticEaseInout)
v.step(.7) // will be ahead of the first value by X seconds
const secondsEasing = function(v) {
// a easing function to flag _time over seconds_ from
// a relative start time.
}
let deltaFrom = 0
let fps = 60
let delta = 14 // ms - for one delta over 1000ms (I think.)
// 1 to 100 over 4 seconds.
v = Value(1, 100, seconds(4, deltaFrom, fps))
v.step(delta)
Meta Data
| filepath_exists | True |
| path | iter/lerp |
| filepath | iter/lerp.js |
| clean_files | () |