1.0.1 • Published 2 years ago

@noxfed/lottie-webpack-loader v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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