statefulTransition2 = function (
state_local,
interpolator_factory,
output_callback,
target_state_accessor = (d) => d
) {
return function (d, i, nodes) {
const initial_state = state_local.get(this);
const target_state = target_state_accessor(d)
const interpolate_state = interpolator_factory(
initial_state,
target_state,
);
return (t) => {
const interpolated_state = interpolate_state(t);
state_local.set(this, {initial: initial_state,
target: target_state,
t: t}
);
return output_callback(interpolated_state, initial_state, target_state);
};
};
}