JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q43031F
  • License ISC

Super-light minimal, fast and memory effecient complex morph tool

Package Exports

  • minimorph

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (minimorph) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

minimorph

Greenkeeper badge Super-light minimal, fast and memory effecient complex morph tool

morph.easing.moca = k => 0.5 + Math.pow(k * k / k * k, 4) / k * k - 0.5

let m = morph(
    { type: 'path',
      value: 'M480,50L423.8,182.6L280,194.8L389.2,289.4L356.4,430L480,355.4L480,355.4L603.6,430L570.8,289.4L680,194.8L536.2,182.6Z'
    },
    { type: 'path',
      value: 'M638.9,259.3v-23.8H380.4c-0.7-103.8-37.3-200.6-37.3-200.6s-8.5,0-22.1,0C369.7,223,341.4,465,341.4,465h22.1c0,0,11.4-89.5,15.8-191h210.2l11.9,191h22.1c0,0-5.3-96.6-0.6-205.7H638.9z'
    }, true)

let mw = morph.middleware([0, 0, 0], [0, 204, 255], 'color');

let p = document.querySelector('#path');
    p.setAttribute('d', m(0))


let _start = 1000, dur = 2000;

requestAnimationFrame(function anim(time) {
  requestAnimationFrame(anim);
  let elapsed = (time - _start) / dur;
  if (elapsed < 0 || elapsed > 1) {
    return false;
   }
 
p.setAttribute('d', m(morph.easing.moca(elapsed)));
p.setAttribute('fill', mw(morph.easing.moca(elapsed)));

});