How to use the d3-ease.ease function in d3-ease

To help you get started, we’ve selected a few d3-ease 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 tejitak / react-state-animation / lib / Animate.js View on Github external
eases.forEach(function (e) {
      // convert to camelCase
      var easeName = e.replace(/-([a-z])/g, function (g) {
        return g[1].toUpperCase();
      });

      // add instance methods dynamically
      _this[easeName] = function (prop, end, duration) {
        return this.animate(prop, end, duration, easeName);
      };

      Easing[easeName] = ease(e);
    });
  }
github tejitak / react-state-animation / src / Animate.js View on Github external
eases.forEach( (e) => {
            // convert to camelCase
            var easeName = e.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });

            // add instance methods dynamically
            this[easeName] = function(prop, end, duration) {
                return this.animate(prop, end, duration, easeName)
            }

            Easing[easeName] = ease(e)

        });
    }
github elierotenberg / react-animate / lib / animate.js View on Github external
export function animate(inst, name, fromStyle, toStyle, duration, {
  easing = DEFAULT_EASING,
  onTick = noop,
  onAbort = noop,
  onComplete = noop,
  preventMobileHA = false,
}) {
  if(isAnimated(inst, name)) {
    abort(inst, name);
  }

  const ease = typeof easing === 'object' ?
    d3ease.ease(...[easing.type, ...easing.arguments]) :
    d3ease.ease(easing)
  ;
  const stylesTransition = _()
    .union(fromStyle)
    .union(toStyle)
    .map(
      (property) => [
        property,
        [
          fromStyle[property] || toStyle[property],
          toStyle[property] || fromStyle[property],
        ],
      ],
    )
    .toPairs()
  .value();
github elierotenberg / react-animate / lib / animate.js View on Github external
export function animate(inst, name, fromStyle, toStyle, duration, {
  easing = DEFAULT_EASING,
  onTick = noop,
  onAbort = noop,
  onComplete = noop,
  preventMobileHA = false,
}) {
  if(isAnimated(inst, name)) {
    abort(inst, name);
  }

  const ease = typeof easing === 'object' ?
    d3ease.ease(...[easing.type, ...easing.arguments]) :
    d3ease.ease(easing)
  ;
  const stylesTransition = _()
    .union(fromStyle)
    .union(toStyle)
    .map(
      (property) => [
        property,
        [
          fromStyle[property] || toStyle[property],
          toStyle[property] || fromStyle[property],
        ],
      ],
    )
    .toPairs()
  .value();