iter/lerp

<script src="./point_src/iter/lerp"></script>

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 ()

  • ClassDeclaration
    class comments:

    let linear = v=>Number(v.toFixed(this.fix));

    • constructor

      constructor

      (
      a , b = 1 , easing = undefined , doneStop
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      setEasing

      (
      easing
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      let linear = v=>Number(v.toFixed(this.fix));

    • method

      width

      (
      a , b
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      t

      (
      v , a , b
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      get

      (
      step , easing , a , b
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      a smoothing function

    • method

      pluck

      (
      a , b , step , easing
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      mutate

      (
      value , easing
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      emitDoneEvent

      (
      value , preValue , mutator , step
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      doneHandler

      (
      value , preValue , mutator , step
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      console.log('done', value, preValue)

    • method

      split

      (
      count = 1
      )
      from Value
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      return a list of numbers, split through the count divisor

      v= new Value(100, 600) v.split(10)[9] == 600 v.split(2) == [100, 600]

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ClassDeclaration
    class comments:

    return an easing function

    • constructor

      constructor

      (
      pointList
      )
      from PointListLerper
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      getCommonValue

      (
      )
      from PointListLerper
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      getCommonEasingFunction

      (
      )
      from PointListLerper
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      return an easing function

    • method

      through

      (
      a , b , settings
      )
      from PointListLerper
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Lerp this entire pointlist from a to b. Settings can be a number or a settings object.

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])