value area around an item

Take your first pic of this thread. Let’s imagine that the green zone is a radioactive area, where its value goes linearly from 0 to 100 (max radiation level - the closest distance to the item).

1.png](filedata/fetch?id=1809486&d=1599587586)

Let the distance between those 2 points be 500 units.

Now, our goal is to determine the value of the radiation at any location between those 2 points:

](filedata/fetch?id=1809487&d=1599588524)

Basically, we need a function that given a distance 0<x<500, returns a corresponding radiation level between 100 and 0.

How do we calculate it? Two ways:

  • manually (too much extra work)
  • using the “Map Range XXX” (quickest option). From the example I gave earlier:

](filedata/fetch?id=1809488&d=1599588785) ​

If you already used progress bars widgets, then you probably already did some mapping operation, where, for example, you had to transform your health value, that goes from 0 to 100, to a value between 0 and 1. Same principle.