0.17.0 • Published 10 months ago

@shoutem/animation v0.17.0

Weekly downloads
414
License
BSD-3-Clause
Repository
github
Last release
10 months ago

Animations

When building an application, there is a need to create animations to enrich the user experience. Although React Native provides a way to implement arbitrary animations, it is not an easy task to do it, even for simple animations. That's where @shoutem/animation package comes in. Package contains animation components that should be wrapped around components that you want to get animated and driver that controls the animations.

Install

$ npm install --save @shoutem/animation

Docs

All the documentation is available on the Developer portal.

Community

Join our community on Facebook. Also, feel free to ask a question on Stack Overflow using "shoutem" tag.

Examples

To see animation components in action, start by creating new React Native project:

$ react-native init HelloWorld

Locate to project and install @shoutem/animation:

$ cd HelloWorld
$ npm install --save @shoutem/animation

Now, simply copy the following to your index.ios.js file of React Native project:

import React, { Component } from 'react';
import {
  AppRegistry,
  Text,
  View,
  ScrollView,
  StyleSheet,
} from 'react-native';

import {
  FadeOut,
  FadeIn,
  ZoomOut,
  ZoomIn,
  ScrollDriver,
} from '@shoutem/animation';

export default class App extends Component<{}> {
  render() {
    // Create new ScrollDriver that will animate animations
    // when passing through scroll positions in input range
    const driver = new ScrollDriver();
    return (
      <ScrollView {...driver.scrollViewProps}>
        <View style={style.container}>
          {/* This will fade out and zoom in on scroll position 100 */}
          <ZoomIn driver={driver} inputRange={[50, 100]} maxFactor={3}>
            <FadeOut driver={driver} inputRange={[50, 100]}>
              <Text>Good Bye</Text>
            </FadeOut>
          </ZoomIn>
          {/* This will fade in and zoom out on scroll position 200 */}
          <ZoomOut driver={driver} inputRange={[150, 200]} maxFactor={3}>
            <FadeIn driver={driver} inputRange={[150, 200]}>
              <Text>Hello</Text>
            </FadeIn>
          </ZoomOut>
        </View>
      </ScrollView>
    );
  }
}

const style = StyleSheet.create({
  container: {
    height: 800,
    flexDirection: 'column',
    justifyContent: 'space-around',
    alignItems: 'center',
  },
});

Finally, run the app!

$ react-native run-ios

For more complex animations, run application from examples folder:

$ git clone git@github.com:shoutem/animation.git
$ cd animation/examples/ShoutemAnimation/
$ npm install
$ react-native run-ios

UI Toolkit

Shoutem UI is a part of the Shoutem UI Toolkit that enables you to build professionally looking React Native apps with ease.

It consists of three libraries:

License

The BSD License

Copyright (c) 2016-present, Shoutem

1.0.0-rc.1

10 months ago

1.0.0-rc.0

10 months ago

0.17.0-beta.0

2 years ago

0.17.0

1 year ago

0.15.0

4 years ago

0.14.1

5 years ago

0.14.0

5 years ago

0.13.1

5 years ago

0.13.1-rc.0

5 years ago

0.13.0

5 years ago

0.13.0-rc.1

5 years ago

0.13.0-rc.0

5 years ago

0.12.5

6 years ago

0.12.4

6 years ago

0.12.4-alpha2

6 years ago

0.12.4-alpha1

6 years ago

0.12.4-alpha0

6 years ago

0.12.3

7 years ago

0.12.2

8 years ago

0.12.1

8 years ago

0.12.0

8 years ago

0.11.1

9 years ago

0.11.0

9 years ago

0.10.2

9 years ago

0.10.1

9 years ago

0.10.0

9 years ago

0.9.2

9 years ago

0.9.1

9 years ago

0.9.0

9 years ago

0.8.10

9 years ago

0.8.9

9 years ago

0.8.8-alpha.0

9 years ago

0.8.7

9 years ago

0.8.6

9 years ago

0.8.5

10 years ago

0.8.2

10 years ago

0.8.1

10 years ago

0.8.0

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago