Consider an array with the following elements: [1,2,5,18,17,8]. Now, if you want to transform this array into a new one with a length of 40 while maintaining the same progression, you can use the following code:
a = [1,2,5,18,17,8];
stepSize = 1 / (40 / a.length);
You can achieve this by doing something like the following:
steps = [];
for( var i = 0; i < 1; i+= stepSize) {
steps.push(d3.interpolate(a[0],a[1])(i));
}
You would then repeat this process for all the elements in the original array. Is there perhaps a more efficient way to accomplish this task?