"Ping Pong" GlobalScope Function #9857
Closed
FireCatMagic
started this conversation in
Engine Core
Replies: 1 comment 3 replies
-
You mean like |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Like "wrap" and "wrapf", but "ping pongs" the value. I'm not sure of a better name for it, but there probably is one.
Example
ping_pong(value, min, max)
This would return a value that approaches max, and then when it gets to max, it starts going back towards min. Basically goes back and forth between the two values.
example:
ping_pong(1.6, 0.0, 1.0)
Returns 0.4
It reaches 1.0, then starts going backwards 0.6, landing at 0.4.
If this function was wrapf, it would return 0.6, because it wraps back to zero and goes from there. But for the ping pong function, it alternates between starting at the maximum and minimum.
Beta Was this translation helpful? Give feedback.
All reactions