Hi, I’m trying to create a smooth transition from one array of numbers to another but the numbers in question are all floating point numbers between 1 and -1, most of which below 0, so it’s been tricky. The arrays in question are also both 512 long which makes it even more confusing.
This is what I’ve done so far.
I calculated the difference between the two arrays (to give an idea I’ll type the first 10 numbers in each array):
let array1 = [0.07622419629758599,0.05842459339422927,0.024668672017524977,-0.09559310702036261,-0.0024750374544100775,-0.13594952209716252,-0.018044980746120338,-0.0084552654890587,-0.06651388597692996,0.07836719933304802];
let array2 = [-0.012255011871074164,0.030888419399735884,-0.06349531322375797,0.06757607476700675,0.06706755973946725,0.16300976540477416,-0.04452763179099016,0.022317034418650683,0.00980828811903469,0.05458174891305839];
let arraySub = [];
for(var i = 0; i < array1.length; i++){
arraySub[i] = array2[i] - array1[i];
}
so at this point the first 10 numbers of arraySub are:
arraySub = [-0.08847920816866016, -0.027536173994493388, -0.08816398524128294, 0.16316918178736936, 0.06954259719387733, 0.2989592875019367, -0.026482651044869823, 0.030772299907709383, 0.07632217409596465, -0.023785450419989626, -0.18150830247924366];
I’m finding it hard to understand how to increment each number so that the first array moves smoothly to become the second, especially since for looping with floating points is imprecise.
Any help on how to pull this off would be much appreciated