normalize-times.mjs 415 B

12345678910111213
  1. /**
  2. * Take an array of times that represent repeated keyframes. For instance
  3. * if we have original times of [0, 0.5, 1] then our repeated times will
  4. * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back
  5. * down to a 0-1 scale.
  6. */
  7. function normalizeTimes(times, repeat) {
  8. for (let i = 0; i < times.length; i++) {
  9. times[i] = times[i] / (repeat + 1);
  10. }
  11. }
  12. export { normalizeTimes };