You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.0 KiB

Interpolation

Instructions

Create a function called interpolation that takes an object with 5 properties step, start, end, callback and duration. This function must calculate the interpolation points, (x, y), from the start position to end position depending on the number of steps. All the points must be calculated in the duration time.

For each interpolation point you must execute and pass as parameters to the callback the interpolation point ([x, y])

Example

steps = 5
start = 0
end = 1
duration = 10

   t
   |
10 |_______________. <- execute callback([1.0, 10])
   |               |
   |               |
 8 |___________.   |
   |           |   |
   |           |   |
 6 |_______.   |   |
   |       |   |   |
   |       |   |   |
 4 |___.   |   |   |
   |   |   |   |   |
   |   |   |   |   |
 2 .   |   |   |   |
   |   |   |   |   |
   |___|___|___|___|___d
   0  0.2 0.4 0.6 0.8

Notions