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

rn-tween

v1.0.4

Published

Help create animated react native tween component

Downloads

4

Readme

rn-tween

It can help animating components by timing.

Installation

  • Using Npm
npm install rn-tween --save
  • Using Yarn
yarn add rn-tween --dev

Tween components

  • RNTween
  • RNTweenView
  • RNTweenImage
  • RNTweenText

Example

Auto start

import {RNTweenView} from 'rn-tween';

<RNTweenView
  autoStartName="transit"
  initialConfig={{
    transit: {
      mode: 'parallel',
      configs: [
        {
          from: 0,
          to: 1,
          duration: 1000,
          styleProperty: 'opacity',
          loop: true,
        },
        {
          from: 0.2,
          to: 1,
          duration: 1000,
          styleProperty: 'scale',
          loop: true,
        },
      ],
    },
  }}
  style={{
    width: 100,
    height: 100,
    backgroundColor: 'red',
  }}
/>;

Call functions

import {RNTweenView} from 'rn-tween';

<RNTweenView
  ref={ref => (_tween = ref)}
  firstUsedConfigName="transit"
  initialConfig={{
    transit: {
      mode: 'parallel',
      configs: [
        {
          from: 0,
          to: 1,
          duration: 500,
          styleProperty: 'opacity',
        },
        {
          from: 0.2,
          to: 1,
          duration: 500,
          styleProperty: 'scale',
        },
      ],
    },
  }}
  style={{
    width: 100,
    height: 100,
    backgroundColor: 'orange',
  }}
/>;

// Stop animating the tweeen with a specific configuration name
_tween.start({name: 'transit'});
_tween.start({name: 'transit', reversed: true});
_tween.start({name: 'transit', reversed: true, onComplete: () => alert('Finished')});

// Stop animating the tween
_tween.stop();

// Reprepare tween animation configurations
_tween.prepare({
  transit: {
    mode: 'sequence',
    configs: [
      {
        from: 0,
        to: 1,
        duration: 500,
        styleProperty: 'opacity',
      },
      {
        from: 0.2,
        to: 1,
        duration: 500,
        styleProperty: 'scale',
      },
    ],
  },
});

Available component props

RNTween

| Name | Type | Default | Description | | ------------------- | --------- | ------- | ---------------------------------------------------------------------------- | | autoStartName | string | null | Tell which animation tween should automatically start at the first time | | firstUsedConfigName | string | null | Tell which animation tween configuration should be applied at the first time | | initialConfig | object | null | The initial tween configurations to be used | | AnimatedComponent | Component | null | The animated component to be animated | | onComplete | function | null | The callback invoked after the tween animation completed |

RNTweenView

Also inherits ViewProps

| Name | Type | Default | Description | | ------------------- | -------- | ------- | ---------------------------------------------------------------------------- | | autoStartName | string | null | Tell which animation tween should automatically start at the first time | | firstUsedConfigName | string | null | Tell which animation tween configuration should be applied at the first time | | initialConfig | object | null | The initial tween configurations to be used | | onComplete | function | null | The callback invoked after the tween animation completed |

RNTweenText

Also inherits TextProps

| Name | Type | Default | Description | | ------------------- | -------- | ------- | ---------------------------------------------------------------------------- | | autoStartName | string | null | Tell which animation tween should automatically start at the first time | | firstUsedConfigName | string | null | Tell which animation tween configuration should be applied at the first time | | initialConfig | object | null | The initial tween configurations to be used | | onComplete | function | null | The callback invoked after the tween animation completed |

RNTweenImage

Also inherits ImageProps

| Name | Type | Default | Description | | ------------------- | -------- | ------- | ---------------------------------------------------------------------------- | | autoStartName | string | null | Tell which animation tween should automatically start at the first time | | firstUsedConfigName | string | null | Tell which animation tween configuration should be applied at the first time | | initialConfig | object | null | The initial tween configurations to be used | | onComplete | function | null | The callback invoked after the tween animation completed |

initialConfig

initialConfig: {
  [name: string]: {
    mode,
    configs
  }
}

| Name | Type | Description | | ------- | ------ | -------------------------------------------------------------- | | mode | string | Specify tween animation mode like parallel or sequence | | configs | array | Array of tween animation configuration |

initialConfig[name].configs[index]

| Name | Type | Description | | ------------- | ------ | -------------------------------------------------------------------------- | | styleProperty | string | Specify any style property to be animated like opacity, scale, etc | | from | number | Value from where the animation starts | | to | number | Value to where the animation must reach | | duration | number | Duration of animation | | delay | number | Delay before the animation starts | | loop | bool | Tell if the animation should play as loop | | easing | function | Easing function to define curve. Default is TweenEasing.linear | | useNative | bool | Uses the native driver when true. Default is true |

Available instance functions

start({ name, reversed, onComplete })

| Name | Type | Description | | ---------- | -------- | --------------------------------------------- | | name | string | Name of tween animation configuration | | reversed | bool | Tell if the animation should play in reverse | | onComplete | function | Callback invoked after the animation complete |

stop()

Stop a running animation

prepare({ mode, configs })

| Name | Type | Description | | ------- | ------ | -------------------------------------------------------------- | | mode | string | Specify tween animation mode like parallel or sequence | | configs | array | Array of tween animation configuration |

License