cordova-plugin-lottie-splashscreen

? ? ? Cordova plugin to show Lottie animations as the splash screen with Airbnb's Lottie wrapper

Github stars Tracking Chart

cordova-plugin-lottie-splashscreen

Build Status

Dependency Status
devDependency Status
Known Vulnerabilities

Commitizen friendly
Dependabot Status
License
npm

Cordova plugin to show bodymovin/Lottie animations as the splash screen with Airbnb's Lottie wrapper

Supported platforms

  • iOS (10+) (with cordova-ios >= 5.0.0 only)
  • Android (with cordova-android >= 8.0.0 only)

Planned platforms

  • macOS

Prerequisites/Warnings

iOS

You need to have CocoaPods installed because lottie-ios is fetched from there.

$ sudo gem install cocoapods
$ pod setup
Caveats

Only cordova >= 9.0.0 and cordova-ios >= 5.0.0 are supported.
You need to specify a valid SwiftVersion (minimum is 4.2) in your config.xml (see https://cordova.apache.org/docs/en/latest/config_ref/)

Android

AndroidX support is required for lottie-android >= 2.8.0.
In order to use version >= v0.7.0 you need to configure AndroidX support.
In case you do not manually build the project and edit the files in Android Studio, these two plugins might be required: https://github.com/dpa99c/cordova-plugin-androidx and https://github.com/dpa99c/cordova-plugin-androidx-adapter.
In the FAQ are some examples with common error messages and how to fix them.

Installation

$ cordova plugin add cordova-plugin-lottie-splashscreen

from git (unstable)

$ cordova plugin add https://github.com/timbru31/cordova-plugin-cordova-plugin-lottie-splashscreen.git

Usage

This Cordova plugin is meant as a replacement for the stock cordova-plugin-splashscreen.
An example project can be found in the example folder.

Methods

  • lottie.splashscreen.hide
  • lottie.splashscreen.show
lottie.splashscreen.hide

This methods hides the current active Lottie splashscreen and destroys the views. Returns a Promise which is resolved with "OK" in the success case or the error message when it's failed.

await lottie.splashscreen.hide();
lottie.splashscreen.show

This method shows a Lottie splash screen. If no arguments are given, it defaults to the config.xml values, however you can pass (new) options here to change the behavior on runtime. Returns a Promise which is resolved with "OK" in the success case or the error message when it's failed. (For easier reading the TypeScript notation is used)

await lottie.splashscreen.show(location?: string, remote?: boolean, width?: number, height?: number)

Preferences

  • LottieRemoteEnabled (Boolean, default false). Toggles Lottie's remote mode which allows files to be downloaded/displayed from URLs. Example:
    <preference name="LottieRemoteEnabled" value="true" />
  • LottieAnimationLocation (String, default ""). Location of the Lottie JSON file that should be loaded. Can either be a URL (if LottieRemoteEnabled is true) or a local JSON or ZIP file (e.g. www/lottie/error.json).
    <preference name="LottieAnimationLocation" value="https://assets.lottiefiles.com/datafiles/99nA1a7mkSF3Oz8/data.json" />
  • LottieImagesLocation (String, default path of LottieAnimationLocation). Android only! Location of the Lottie images folder specified by the JSON.
    <preference name="LottieImagesLocation" value="www/lottie/images" />
  • LottieCancelOnTap (Boolean, default false). Immediately cancels the Lottie animation when the user taps on the screen.
    <preference name="LottieCancelOnTap" value="true" />
  • LottieHideTimeout (Double, default 0). Duration in seconds after which the Lottie animation should be hidden.
    <preference name="LottieHideTimeout" value="10" />
  • LottieBackgroundColor (String, default #ffffff). Background color of the overlay. Can be used with alpha values, too. (For more information see the 8 digits notation of RGB notation)
    <preference name="LottieBackgroundColor" value="#fff000a3" />
  • LottieWidth (Integer, default 200). Width of the container that's rendering the Lottie animation
    <preference name="LottieWidth" value="750" />
  • LottieHeight (Integer, default 200). Height of the container that's rendering the Lottie animation
    <preference name="LottieHeight" value="750" />
  • LottieRelativeSize (Boolean, default false). Uses width and height values as relative values. Specify them as e.g. 0.3 to have 30%.
    <preference name="LottieRelativeSize" value="true" />
  • LottieFullScreen (Boolean, default false). Renders the animation in full screen. Ignores properties above.
    <preference name="LottieFullScreen" value="true" />
  • LottieLoopAnimation (Boolean, default false). Loops the animation
    <preference name="LottieLoopAnimation" value="true" />
  • LottieAutoHideSplashScreen (Boolean, default false). Hides the Lottie splash screen when the pageDidLoad event fired
    <preference name="LottieAutoHideSplashScreen" value="true" />
  • LottieEnableHardwareAcceleration (Boolean, default false). Android only! Enables hardware acceleration for the animation view. Not really recommended since Lottie decides automatically whether the hardware mode should be used or not.
    <preference name="LottieEnableHardwareAcceleration" value="true" />
    <preference name="LottieScaleType" value="CENTER_CROP" />
  • LottieCacheDisabled (Boolean, default false). Disables caching of animations.
    <preference name="LottieCacheDisabled" value="true" />

Built by (c) Tim Brust and contributors. Released under the MIT license.

Main metrics

Overview
Name With Ownertimbru31/cordova-plugin-lottie-splashscreen
Primary LanguageKotlin
Program languageSwift (Language Count: 6)
Platform
License:MIT License
所有者活动
Created At2017-10-02 19:55:13
Pushed At2025-04-16 15:54:55
Last Commit At2025-04-14 15:12:17
Release Count39
Last Release Namev0.10.0 (Posted on 2023-02-20 12:26:47)
First Release Namev0.1.0 (Posted on 2018-01-21 22:29:31)
用户参与
Stargazers Count133
Watchers Count3
Fork Count57
Commits Count1k
Has Issues Enabled
Issues Count113
Issue Open Count19
Pull Requests Count594
Pull Requests Open Count2
Pull Requests Close Count150
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private