@noxfed/lottie-webpack-loader

1.0.1 • Public • Published

Load assets for json lottie-web files

Usage

npm install @noxfed/lottie-webpack-loader --save-dev

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        type: 'javascript/auto',
        test: /\.json$/,
        include: /(lottie)/,
        loader: 'lottie-web-webpack-loader',
      }
    ]
  }
}

animation.js

import lottie from 'lottie-web';
import animationData from '@/assets/lottie/hero/index.json';

const heroAnimation = lottie.loadAnimation({
  container: document.getElementById('hero-animation'),
  renderer: 'svg',
  animationData
});

heroAnimation.goToAndPlay(0, true);

License

MIT

Package Sidebar

Install

npm i @noxfed/lottie-webpack-loader

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.08 kB

Total Files

3

Last publish

Collaborators

  • yangff
  • hayleyxs
  • xiashan
  • lihxhit