Prepare repository for merge

This commit is contained in:
Angelos Chalaris
2023-05-01 22:35:56 +03:00
parent fc4e61e6fa
commit b3ad01863a
578 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,20 @@
---
title: Map number to range
type: snippet
tags: [math]
cover: clutter
dateModified: 2020-10-21T21:54:53+03:00
---
Maps a number from one range to another range.
- Return `num` mapped between `outMin`-`outMax` from `inMin`-`inMax`.
```js
const mapNumRange = (num, inMin, inMax, outMin, outMax) =>
((num - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
```
```js
mapNumRange(5, 0, 10, 0, 100); // 50
```