API Reference › Tween › Tween.point
method

Tween.point

Tween.point(from, to, t) -> Vector

Interpolates two Vector endpoints component-wise by amount t — the 2D version of Tween.number. Move an entity along a straight path, or ease a camera toward a target, in one call.

Parameters

fromthe point at t = 0 (a Vector)
tothe point at t = 1 (a Vector)
tthe blend amount (a fixed, usually 0..1)

Example

program Demo {
  handler Run phase Update {
    let a = Vector.make(fixed(0), fixed(0))
    let b = Vector.make(fixed(100), fixed(40))
    let t = Tween.progress(fixed(1), fixed(2))
    let p = Tween.point(a, b, Tween.ease(t, 3))
    print(Vector.x(p))
  }
}
← All symbols