User Tools

Site Tools


4rpl:commands:numrepeat

Index

:!: Available in version 2.5 and later.

NumRepeat

NumRepeat(<-value <-period)

Description

Loops <-value, so that it is never larger than <-period and never smaller than 0.

This is similar to the modulo operator but it works with floating point numbers. For example, using 3.0 for <-value and 2.5 for <-period, the result would be 0.5. With t = 5 and length = 2.5, the result would be 0.0. Note, however, that the behavior is not defined for negative numbers as it is for the modulo operator.

In the example below, the value of time is restricted between 0.0 and just under 3.0. When the value of time is 3, the x position will go back to 0, and go back to 3 as time increases, in a continuous loop.

Examples

# need worked example

Index

4rpl/commands/numrepeat.txt · Last modified: 2024/05/24 10:43 by Up-Level