GithubHelp home page GithubHelp logo

gnipbao / puppeteer-lottie-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from transitive-bullshit/puppeteer-lottie-cli

1.0 1.0 0.0 399 KB

CLI for rendering Lottie animations via Puppeteer to image, GIF, or MP4.

JavaScript 100.00%

puppeteer-lottie-cli's Introduction

puppeteer-lottie-cli

CLI for rendering Lottie animations via Puppeteer to image, GIF or MP4.

NPM Build Status JavaScript Style Guide

Logo

This CLI is also available as a library.

Install

npm install -g puppeteer-lottie-cli

If you want to generate GIFs, you must also install gifski. On macOS, you can run:

brew install gifski

If you want to generate MP4s, you must also install ffmpeg. On macOS, you can run:

brew install ffmpeg

Usage

Usage: puppeteer-lottie [options]

Options:
  -i, --input <path>     relative path to the JSON file containing animation data
  -o, --output <path>    relative path to store output media (image, image pattern, gif, or mp4) (default: "out.png")
  -w, --width <number>   optional output width
  -h, --height <number>  optional output height
  -b, --background <css-color-value>
                         optional output background color (default: "transparent")
  -q, --quiet            disable output progress
  -V, --version          output the version number
  -h, --help             output usage information

Output must one of the following:
  - An image to capture the first frame only (png or jpg)
  - an image pattern (eg. sprintf format 'frame-%d.png' or 'frame-%012d.jpg')
  - an mp4 video file (requires FFmpeg to be installed)
  - a GIF file (requires Gifski to be installed)
Examples:
  $ puppeteer-lottie -i fixtures/bodymovin.json -o out.mp4
  $ puppeteer-lottie -i fixtures/bodymovin.json -o out.gif --width 640
  $ puppeteer-lottie -i fixtures/bodymovin.json -o 'frame-%d.png' --width 1024 --height 1024

Output Size

If you don't pass width or height, the animation's intrinsic size will be used, and if that doesn't exist it will use 640x480.

If you pass width or height, the other dimension will be inferred by maintaining the original animation's aspect ratio.

If both width and height are passed, the output will have those dimensions, but there will be extra whitespace (or transparency if rendering PNGs) due to lottie-web's default rendererSettings.preserveAspectRatio of xMidyMid meet (docs and demo).

For mp4 outputs, the height may be different by a pixel due to the x264 encoder requiring even heights.

Compatibility

All lottie-web features should be fully supported by the svg, canvas, and html renderers.

This includes all of the animations on lottiefiles.com! ๐Ÿ”ฅ

Also see Lottie's full list of supported features.

Related

License

MIT ยฉ Travis Fischer

Support my OSS work by following me on twitter twitter

puppeteer-lottie-cli's People

Contributors

transitive-bullshit avatar mgd020 avatar gnipbao avatar

Stargazers

Roman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.