Documentation ¶
Index ¶
- func Lerp(start, end, progress, range_ int) (result int)
- type Vec2
- func (v Vec2) Abs() Vec2
- func (v Vec2) Add(v1 Vec2) Vec2
- func (v Vec2) Ceil() Vec2
- func (v Vec2) Div(v1 Vec2) Vec2
- func (v Vec2) Floor() Vec2
- func (v Vec2) Mul(v1 Vec2) Vec2
- func (v Vec2) Neg() Vec2
- func (v0 Vec2) RightTo(v1 Vec2, v2 Vec2) bool
- func (v Vec2) Round() Vec2
- func (v Vec2) RoundTo(places int) Vec2
- func (v Vec2) Scale(s int) Vec2
- func (v Vec2) Sub(v1 Vec2) Vec2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Lerp ¶
Lerp performs a linear interpolation between start and end, using progress as a percentage of the total range. If progress is outside the range [0, range_], the function will panic. If range_ is zero, the function will panic.
The result is rounded to the nearest integer.
Example usage:
Lerp(10, 20, 50, 100) = 15
The above will interpolate between 10 and 20, using 50% of the total range of 100. The result is 15.
Types ¶
Click to show internal directories.
Click to hide internal directories.