How to use the d3-ease.easeCubic 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 DefinitelyTyped / DefinitelyTyped / d3-ease / d3-ease-tests.ts View on Github external
* are not intended as functional tests.
 */

import * as d3Ease from 'd3-ease';

let t_in: number = 0.5;
let t_out: number;

t_out = d3Ease.easeLinear(t_in);

t_out = d3Ease.easeQuad(t_in);
t_out = d3Ease.easeQuadIn(t_in);
t_out = d3Ease.easeQuadOut(t_in);
t_out = d3Ease.easeQuadInOut(t_in);

t_out = d3Ease.easeCubic(t_in);
t_out = d3Ease.easeCubicIn(t_in);
t_out = d3Ease.easeCubicOut(t_in);
t_out = d3Ease.easeCubicInOut(t_in);


let easePolyFactory: d3Ease.PolynomialEasingFactory;

easePolyFactory = d3Ease.easePoly;
easePolyFactory = d3Ease.easePoly.exponent(2);
t_out = easePolyFactory(t_in);

easePolyFactory = d3Ease.easePolyIn;
easePolyFactory = d3Ease.easePolyIn.exponent(2);
t_out = easePolyFactory(t_in);

easePolyFactory = d3Ease.easePolyOut;
github molefrog / stateful-animations / src / ficus / cloud-poll / index.js View on Github external
let bEl = this.$el.querySelector(`[data-id="${d.id}"] .cloud-poll__entry-count`)

          if (!aEl || !bEl) {
            return
          }

          const aOffset = this.relativeOffset(aEl)
          const bOffset = this.relativeOffset(bEl)

          const aX = aOffset[0] + 0.5 * aEl.offsetWidth
          const aY = aOffset[1] + 0.5 * aEl.offsetHeight

          const bX = bOffset[0] + 0.5 * bEl.offsetWidth
          const bY = bOffset[1] + 0.5 * bEl.offsetHeight

          let tx = easeCubic(t)
          let ty = t

          if (d.count < 0) {
            tx = 1 - tx
            ty = 1 - ty
          }

          const x = aX + (bX - aX) * tx
          const y = aY + (bY - aY) * ty

          const CP_1 = 0.2
          const CP_2 = 0.01

          let scale = 1.0
          let opacity = 1.0