-
Notifications
You must be signed in to change notification settings - Fork 7
Rounding
Swifter edited this page Oct 23, 2024
·
6 revisions
-
rm.roundTolets you round a number to the nearest multiple of another number.
rm.roundTo(input, step)
rm.roundTo(1, 1) // 1
rm.roundTo(1, 2) // 2
rm.roundTo(1, 3) // 0-
rm.floorTolets you floor a number to the nearest multiple of another number.
rm.floorTo(input, step)
rm.floorTo(5, 1) // 5
rm.floorTo(5, 2) // 4
rm.floorTo(5, 3) // 3-
rm.ceilTolets you ceil a number to the nearest multiple of another number.
rm.ceilTo(input, step)
rm.ceilTo(3, 1) // 1
rm.ceilTo(3, 2) // 4
rm.ceilTo(3, 3) // 3-
rm.clamplets you ensure a number stays between a minimum and maximum.
rm.clamp(input, min, max)
rm.clamp(0, 1, 3) // 1
rm.clamp(2, 1, 3) // 2
rm.clamp(4, 1, 3) // 3You can also leave either the low bow or the high bound as undefined to ignore them.
// Ignore minimum
rm.clamp(0, undefined, 3) // 0
rm.clamp(4, undefined, 3) // 3// Ignore maximum
rm.clamp(0, 1, undefined) // 1
rm.clamp(4, 1, undefined) // 4-
rm.positiveModwill perform a modulo operation such that the output is always positive.
-0.3 % 1 // -0.3
rm.positiveMod(-0.3, 1) // 0.7Blue is x % 1, red is rm.positiveMod(x, 1)

-
rm.setDecimalslets you set the decimal place precision of a number.
rm.setDecimals(Math.PI, 2) // 3.14
rm.setDecimals(Math.PI, 3) // 3.142
rm.setDecimals(Math.PI, 4) // 3.1416
rm.setDecimals(Math.PI, 5) // 3.14159
rm.setDecimals(Math.PI, 6) // 3.141593Note: If you're thinking about having to do this to save file size on your map, that is already handled by settings.
- Info
- Difficulty
- Beatmap Objects
- Gameplay Objects
- Walls
- Basic Notemods
- Note Iterators
- Basic Events
- V3 Events
- Custom Events
- Heck Tracks and Animation
- Easings
- Point Types
- Point Utilities
- Heck Animation Baking
- Heck Animation Settings
Non-Vivify Models
Vivify