def linear_decay_fn(start_pos_val,
                    end_pos_val,
                    name="Linear Decay"):
    """
    Returns function to generate values with linear decay corresponding to (start/end)_pos_val
    
    ----------
    Arguments:
    start_pos_val: tuple/list of 2 integers
        -
    end_pos_val: tuple/list of 2 integers
        -
    
    --------
    Returns:
    Python function
        -> fn(x), takes 1 argument, position:float
        -> Returns value:float
    """
    # Swap for convenience if
    assert start_pos_val[0] < end_pos_val[0], ""

    def fn(x):
        if not start_pos_val[0] <= x <= end_pos_val[0]:
            raise ValueError(f"{name} | Position {x} is not in the range of specified positions: {start_pos_val[0]}->{end_pos_val[1]}")

        return start_pos_val[1] + (x - start_pos_val[0]) / (end_pos_val[0] - start_pos_val[0]) * (end_pos_val[1] - start_pos_val[1])
    return fn