# t: t
# title: calcmodespline
def _map(r_time, steps=[0.0, 0.5]):
""" only linear [0, 0.33, 0.66, 1.0] here, values=[] would require interpretation in handlers """
dist = 1.0 / len(steps) # 0.25 for len=4
offs = int(r_time * len(steps)) # 0.30 → map [1]
steps = steps[:] + [1.0, 1.0]
val_diff = steps[offs+1] - steps[offs] # 0.33-0.25
off_diff = (r_time - dist * offs) / dist # offset [2]+0.1 to quantify value
return steps[offs] + val_diff * off_diff
def test_map_calcmode_spline():
for r in range(0, 21):
print(_map(r/20.0))