Define a numeric range.
More...
|
| Span (float a, float z) |
| Initialize with the specified values. More...
|
|
override string | ToString () |
| Return a string of the a and z . More...
|
|
string | ToString (string format) |
| Return a string of the a and z . More...
|
|
bool | Contains (float value) |
| Determine if the value is within this span. More...
|
|
float | Shuffle () |
| Get a random value within this span. More...
|
|
float | Clamp (float value) |
| Get the value clamped by this span. More...
|
|
float | Lerp (float t, bool clamp=true) |
| Linearly interpolate between span by the fraction t . More...
|
|
float | InverseLerp (float value, bool clamp=true) |
| Calculates the interpolation parameter between this span. More...
|
|
|
float | size [get, set] |
| The distance from a to z , negative if z is smaller. More...
|
|
float | center [get, set] |
| The center between a and z , keep the size when setting. More...
|
|
float | min [get, set] |
| The min value of a and z , keep the sides when setting. More...
|
|
float | max [get, set] |
| The max value of a and z , keep the sides when setting. More...
|
|
Span |
( |
float |
a, |
|
|
float |
z |
|
) |
| |
Initialize with the specified values.
- Parameters
-
a | The start value. |
z | The end value. |
static bool TryParse |
( |
string |
s, |
|
|
out Span |
result |
|
) |
| |
|
static |
Try to parse a string
to Span
.
- Parameters
-
s | String. |
result | The result Span . |
- Returns
true
, if success to parse.
static Span Parse |
( |
string |
s | ) |
|
|
static |
Parse a string
to Span
.
- Parameters
-
- Returns
- The result
Span
.
override string ToString |
( |
| ) |
|
Return a string
of the a
and z
.
- Returns
- A
string
represents this.
string ToString |
( |
string |
format | ) |
|
Return a string
of the a
and z
.
- Parameters
-
- Returns
- A
string
represents this.
bool Contains |
( |
float |
value | ) |
|
Determine if the value is within this span.
- Parameters
-
- Returns
true
if the value is within this span.
Get a random value within this span.
- Returns
- The random value.
float Clamp |
( |
float |
value | ) |
|
Get the value clamped by this span.
- Parameters
-
- Returns
- The clamped value.
float Lerp |
( |
float |
t, |
|
|
bool |
clamp = true |
|
) |
| |
Linearly interpolate between span by the fraction t
.
- Parameters
-
t | Time from 0 to 1. |
clamp | If to clamp within this span. |
- Returns
- The interpolated value.
float InverseLerp |
( |
float |
value, |
|
|
bool |
clamp = true |
|
) |
| |
Calculates the interpolation parameter between this span.
- Parameters
-
value | Value. |
clamp | If to clamp between 0 to 1. |
- Returns
- The interpolation time.
The distance from a
to z
, negative if z
is smaller.
The center between a
and z
, keep the size
when setting.
The min value of a
and z
, keep the sides when setting.
The max value of a
and z
, keep the sides when setting.