How to use the react-map-gl/utils/transition-manager.cropEasingFunction function in react-map-gl

To help you get started, we’ve selected a few react-map-gl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / react-map-gl / test / src / utils / transition-manager.spec.js View on Github external
// testing duration
      const testDuration =
        mode === TRANSITION_EVENTS.UPDATE
          ? testCase.input[ti].transitionDuration - UPDATE_INTERVAL
          : testCase.input[ti].transitionDuration;
      t.is(
        equals(transitionManager.state.duration, testDuration, 1e-7),
        testCase.shouldChange[mode].transitionDuration,
        'transitionDuration match'
      );

      // testing easing function
      let testEasingFunc = testCase.input[ti].transitionEasing;
      if (mode === TRANSITION_EVENTS.UPDATE) {
        const completion = UPDATE_INTERVAL / testCase.input[ti].transitionDuration;
        testEasingFunc = cropEasingFunction(testCase.input[ti].transitionEasing, completion);
      }

      t.is(
        compareFunc(transitionManager.state.easing, testEasingFunc, 0.1),
        testCase.shouldChange[mode].transitionEasing,
        'transitionEasing match'
      );

      // We provided an external timer so the animation never ends.
      // The test cannot end if there is a pending animation frame requested.
      transitionManager._endTransition();
    }
  });
  t.end();
github uber / react-map-gl / test / src / utils / transition-manager.spec.js View on Github external
interruptions.forEach(x0 => {
      var newEasing = cropEasingFunction(func, x0);
      t.ok(equals(newEasing(0), 0), 'cropped easing function starts at (0, 0)');
      t.ok(equals(newEasing(1), 1), 'cropped easing function ends at (1, 1)');
      values.forEach(val => {
        t.ok(
          equals(func(x0 + val * (1 - x0)), func(x0) + (1 - func(x0)) * newEasing(val)),
          'cropped easing function matches the old one'
        );
      });
    });
  });