Skip to reading
GDScript Programming & Godot

Lerp()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page
Code example
Lerp(from_value: float, to_value: float, weight: float) -> float

Interpolate two float values.

Returns: Float.

Code example
Lerp(10.0, 20.0, 0.25)

This wrapper uses lerpf; use native vector/color methods for those types.

RandomInteger()#

Code example
RandomInteger(minimum: int, maximum: int) -> int

Choose an integer including both endpoints.

Returns: Integer.

Code example
RandomInteger(1, 6)

Randomize()#

Code example
Randomize(seed_value: int = -1) -> void

Reseed global randomness, or use normal randomization when the supplied seed is negative.

Returns: Void.

Code example
Randomize(1234)

A seed affects the shared random sequence. A native RandomNumberGenerator can keep a separate sequence.

RandomFloat()#

Code example
RandomFloat(minimum: float = 0.0, maximum: float = 1.0) -> float

Choose a float within the supplied interval.

Returns: Float.

Code example
RandomFloat(0.25, 0.75)
Page 84 of 378Permalink
Go to page