topdownengine.math Reference¶
lerp(start, end, t)
¶
This function linearly interpolates two floats or Vectors. Accepts t values outside of the [0, 1] range. The start and end MUST be the same type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
float | Vector2
|
Start Vector2/float |
required |
end
|
float | Vector2
|
End Vector2/float |
required |
t
|
float
|
Interpolation weight |
required |
Returns:
| Type | Description |
|---|---|
Vector2 | float
|
pygame.Vector2|float: The interpolated Vector2/float |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Source code in topdownengine\math.py
scale_rect(rect, scalar)
¶
This function scales a Rect's position and size by a given scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rect
|
Rect | FRect
|
The Rect object to scale |
required |
scalar
|
int | float
|
The number to scale by |
required |
Returns:
| Type | Description |
|---|---|
Rect | FRect
|
pygame.Rect|pygame.FRect: The scaled Rect object |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |