npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

taro-lottie

v1.0.2

Published

lottie for taro

Downloads

81

Readme

taro-lottie

Lottie component for Taro, reference lottie-react-native add web and miniprogram support, base on lottie-web and lottie-miniprogram.

Installing

yarn add taro-lottie

Extra Installing For React Native

Install lottie-react-native (latest) and lottie-ios (3.4.0):

yarn add lottie-react-native
yarn add [email protected]

Go to your ios folder and run:

pod install

Basic Usage

import LottieView, { LottieViewType } from 'taro-lottie'
import lottieData from './lottieData.json'

export default class Lottie extends Component {
  animation: LottieViewType | null = null
  // miniprogram needs to init after page onReady event
  onReady(){
    this.animation?.init()
  }
  render() {
    return (
      <LottieView
        ref={ animation => {
          this.animation = animation;
        }}
        style={
          {
            width: 100,
            height: 100
          }
        }
        autoPlay={true}
        loop={true}
        source={lottieData}
      />
    );
  }
}

Component API

Based on lottie-react-native project, under the Apache License 2.0.

| Prop | Description | Default | Platform | |---|---|---|---| |source| Mandatory - The source of animation. Can be referenced as a local asset by a string, or remotely with an object with a uri property, or it can be an actual JS object of an animation, obtained (for example) with something like require('../path/to/animation.json') |None| All | |progress| A number between 0 and 1, or an Animated number between 0 and 1. This number represents the normalized progress of the animation. If you update this prop, the animation will correspondingly update to the frame at that progress value. This prop is not required if you are using the imperative API. |0| All | |speed| The speed the animation will progress. Sending a negative value will reverse the animation |1| All | |duration| The duration of the animation in ms. Takes precedence over speed when set. This only works when source is an actual JS object of an animation. |undefined| RN | |loop|A boolean flag indicating whether or not the animation should loop. |true| All | |autoPlay|A boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API. |false| All | |autoSize|A boolean flag indicating whether or not the animation should size itself automatically according to the width in the animation's JSON. This only works when source is an actual JS object of an animation. |false| RN | |resizeMode|Determines how to resize the animated view when the frame doesn't match the raw image dimensions. Supports cover, contain and center. |contain| RN | |style|Style attributes for the view, as expected in a standard View, aside from border styling |None| All | |imageAssetsFolder| Needed for Android to work properly with assets, iOS will ignore it. |None| Android | |onAnimationFinish| A callback function which will be called when animation is finished. This callback is called with a boolean isCancelled argument, indicating if the animation actually completed playing, or if it was cancelled, for instance by calling play() or reset() while is was still playing. Note that this callback will be called only when loop is set to false. |None| All | |renderMode| Only Android, a String flag to set whether or not to render with HARDWARE or SOFTWARE acceleration |AUTOMATIC| Android | |cacheComposition| Only Android, a boolean flag indicating whether or not the animation should do caching. |true| Android | |colorFilters| An array of objects denoting layers by KeyPath and a new color filter value (as hex string). |[]| RN | |textFiltersAndroid| Only Android, an array of objects denoting text values to find and replace. |[]| Android | |textFiltersIOS| Only iOS, an array of objects denoting text layers by KeyPath and a new string value. |[]| iOS |

Methods (Imperative API):

Based on lottie-react-native project, under the Apache License 2.0.

| Method | Description | |---|---| |play| Play the animation all the way through, at the speed specified as a prop. It can also play a section of the animation when called as play(startFrame, endFrame). |reset| Reset the animation back to 0 progress. |pause| Pauses the animation. |resume| Resumes the paused animation. |init| Init the animation. Required for miniprogram

More

View more documentation, FAQ, help, examples, and more at airbnb.io/lottie

Example1

Example2

Example3

Community

Example4

License

MIT License