Skip to content

Api > Mathf > PingPong()


Mathf.PingPong(number t, number length)⚓︎

PingPong returns a value that will increment and decrement between the value 0 and length.

Parameters:⚓︎

Name Type Description
t number a self-incrementing value
length number length

Returns:⚓︎

type Description
number a value that will increment and decrement between the value 0 and length.

Usage⚓︎

---@type number
local t;

---@type number
local length;


local val0 = Mathf:PingPong(t, length)

Extra Detail⚓︎

PingPong requires the value t to be a self-incrementing value, for example Time.time, and Time.unscaledTime.