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

react-native-anime

v0.0.47

Published

(Inspired by Cheetah for Swift: https://github.com/suguru/Cheetah)

Downloads

41

Readme

React Native Anime

(Inspired by Cheetah for Swift: https://github.com/suguru/Cheetah)

Anime is an animation utility for React Native. It's built on top of the Animated module, and provides a much simpler API for handling animations.

The library is still in early development. I also need to add a proper API documentation. Open issues if you find any bugs, and contributions are also welcomed!

Features

  • Animations with durations and delays
  • Parallel/Serial executions
  • Easings
  • Springs

Installation

$ npm i react-native-anime

OR

$ yarn add react-native-anime

Code Example

  1. Import Anime
import Anime from 'react-native-anime';
  1. Wrap your view with Anime component and save its reference
render () {
    return (
        <Anime.View ref={ ref => this.box = ref }>
            <View style={ styles.box }/>
        </Anime.View>
    )
}
  1. Use the reference to animate your component
onClick() {
    this.box.moveX(100, { duration: 1500 }).start();
}

// You can also stop an animation with a .stop() method, and reset the component's styling with .reset()
stopAndReset() {
    this.box.stop();
    this.box.reset();
}

simple-move

Available methods

Translate:

translateX
translateY
moveX // Relative to last X translation
moveY // Relative to last Y translation

Skew:

skewX
skewY

Prespective:

perspective

Scale:

scale

Rotate:

rotateZ OR rotate
rotateX
rotateY

Borders:

borderRadius
borderWidth
borderColor

Text:

fontSize
color

Layout:

height
width
opacity
backgroundColor
zIndex

Parallel execution

Anime groups animation properties and executes them at once.

    this.box
        .moveX(50)
        .moveY(50)
        .rotate(180)
        .start()

parallel

Sequence execution

wait will wait until all animations placed before it completed. It can also receive milliseconds to wait to start next animation

    this.box
        // first animation
        .moveX(50)
        .scale(1.5)
        // wait 1s before starting second animation
        .wait(1000)
        // second animation
        .moveX(-50)
        .scale(0.5)
        .start()

sequence

Duration, delay, easing

Just like with Animated, you can specify durations, delays and easings for your animations

    import { Easing } from 'react-native';

    animate() {
        this.box
            .skewX(50, { duration: 2000, easing: Easing.bounce })
            .rotateY(-100, { delay: 2000 })
            .start();
    }

duration

Spring

You can also use Animated's spring animations, together with all its options (http://browniefed.com/react-native-animation-book/api/SPRING.html)

    this.box
        .height(100, { spring: { friction: 1, velocity: 100 } })
        .borderRadius(100)
        .start()

    // or simply use `spring: true` for default spring behaviour
    this.box
        .moveX(50, { spring: true })
        .start()

spring

Also supports Image, Text and ScrollView

Like with Animated module, you can also animate Text, Image and ScrollView components

    render() {
        return (
            <Anime.Image ref={ ref => this.image = ref }
                         source={{ require('pikachu.gif') }} />
        )
    }

    animate() {
        this.image
            .skewX(5, { spring: true })
            .skewY(5, { spring: true })
            .wait()
            .rotate(360*20, { duration: 2000 })
            .start()
    }

image

Parallel animation of numerous components

    render() {
        return (
            <View>
            	<Anime.View ref={ ref => this.box = ref }
            		    style={{ width: 50, height: 50, backgroundColor: 'blue' }}/>

            	<Anime.Text ref={ ref => this.text = ref }
            		    style={{ color: 'blue', fontSize: 12 }}>
            		Very easy
            	</Anime.Text>
            </View>
        )
    }

    animateComponents() {
        const box = this.box.rotate(90);
        const text = this.text.color('red');

        const parallel = new Anime.Parallel([box, text]);

        // Start parallel animation for both components, and reset them both when it ends
        parallel.start(() => parallel.reset())
    }

numerous