Skip to content

imcuttle/snap-fade-away

Repository files navigation

snap-fade-away

Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

The effection like Thanos snapping finger

Live Demo

Installation

npm install snap-fade-away
# or use yarn
yarn add snap-fade-away

Usage

import snapFadeAway from 'snap-fade-away'

async (() => {
  await snapFadeAway(window.root)
  // Animated!
})()

API

snapFadeAway

index.js:62-135

The effect like Thanos snapping finger

Parameters

  • elem {HTMLElement} The animating element
  • opts {{}}
    • opts.frameCount {number} (optional, default 20)
    • opts.debug {boolean} (optional, default false)
    • opts.duration {string} The animation duration (optional, default '2s')
    • opts.relativeElem {HTMLElement} Mount on where (optional, default document.documentElement)
    • opts.canvasClassName {string} (optional, default 'snap-fade-away-canvas')

Returns Promise<any>

Contributing

  • Fork it!
  • Create your new branch:
    git checkout -b feature-new or git checkout -b fix-which-bug
  • Start your magic work now
  • Make sure npm test passes
  • Commit your changes:
    git commit -am 'feat: some description (close #123)' or git commit -am 'fix: some description (fix #123)'
  • Push to the branch: git push
  • Submit a pull request :)

Authors

This library is written and maintained by imcuttle, moyuyc95@gmail.com.

License

MIT - imcuttle 🐟