Condition: A list of objects comes (say, 20 pieces), each of which has a property (let's call it Z) and this is random (0, 100)
Task: Build a smart grid using masonry, setting the height of each block based on the incoming parameters:
- minimum allowable height
- maximum allowable height
- the lowest Z of all received objects
- the highest Z of all received objects
- Z current object (in the loop when drawing)
The function looks like this:
const getHeight = (max_Z, min_Z, obj_Z, max_size = 550, min_size = 150) => { return ((obj_Z - min_Z) / (max_Z - min_Z)) * (max_size - min_size) + min_size; } However, the problem is that between the largest and smallest elements, all elements are distributed linearly. I also need the ratio in size between the elements to be proportional. How to achieve this mind I will not put