# Animations
<hr />
When building an application, there is a need to create animations to enrich the user experience. Although React Native [provides a way](https://facebook.github.io/react-native/docs/animations.html) 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
```bash
$ npm install --save @shoutem/animation
```
## Docs
All the documentation is available on the [Developer portal](http://shoutem.github.io/docs/ui-toolkit/animation/introduction).
## Community
Join [our community](https://www.facebook.com/groups/shoutem.community/) on Facebook. Also, feel free to ask a question on Stack Overflow using ["shoutem" tag](http://stackoverflow.com/tags/shoutem).
## Examples
To see animation components in action, start by creating new React Native project:
```bash
$ react-native init HelloWorld
```
Locate to project and install `@shoutem/animation`:
```bash
$ cd HelloWorld
$ npm install --save @shoutem/animation
```
Now, simply copy the following to your `index.ios.js` file of React Native project:
```javascript
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!
```bash
$ react-native run-ios
```
For more complex animations, run application from `examples` folder:
```bash
$ 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:
- [@shoutem/ui](https://github.com/shoutem/ui): beautiful and customizable UI components
- [@shoutem/theme](https://github.com/shoutem/theme): “CSS-way” of styling entire app
- [@shoutem/animation](https://github.com/shoutem/animation): declarative way of applying ready-made animations
## License
[The BSD License](https://opensource.org/licenses/BSD-3-Clause)
Copyright (c) 2016-present, [Shoutem](http://shoutem.github.io)
没有合适的资源?快使用搜索试试~ 我知道了~
为您的ReactNative组件制作动画_JavaScript_下载.zip
共110个文件
js:37个
ttf:21个
json:8个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 75 浏览量
2023-04-21
10:49:23
上传
评论
收藏 1.8MB ZIP 举报
温馨提示
为您的ReactNative组件制作动画_JavaScript_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
为您的ReactNative组件制作动画_JavaScript_下载.zip (110个子文件)
gradlew.bat 2KB
BUCK 2KB
BUCK 152B
.buckconfig 114B
.editorconfig 421B
.eslintignore 22B
.flowconfig 1KB
.gitattributes 16B
.gitignore 763B
.gitignore 25B
build.gradle 6KB
build.gradle 642B
settings.gradle 579B
gradlew 5KB
AppDelegate.h 451B
gradle-wrapper.jar 51KB
MainApplication.java 1KB
MainActivity.java 377B
ZoomableComponent.js 8KB
connectAnimation.js 8KB
Parallax.js 3KB
animations.js 3KB
ScrollDriver.js 3KB
SlideInOut.js 3KB
animated-style.js 3KB
Slide.js 2KB
AnimationExamples.js 2KB
ZoomOut.js 2KB
ZoomIn.js 2KB
Rotate.js 2KB
SlideIn.js 2KB
SlideOut.js 2KB
Wiggle.js 2KB
FadeIn.js 2KB
FadeOut.js 2KB
TouchableDriver.js 1KB
Rotate.js 1KB
HeroHeader.js 1KB
index.js 1KB
HeroHeader.js 1KB
TimingDriver.js 1KB
measure.js 1KB
Parallax.js 1KB
SpringDriver.js 990B
ZoomInOut.js 869B
FadeInOut.js 751B
ZoomInTouchable.js 621B
DriverBase.js 553B
jest.config.js 299B
App.js 267B
babel.config.js 254B
DriverShape.js 227B
View.js 203B
App.js 159B
index.js 136B
package-lock.json 726KB
package-lock.json 538KB
restaurants.json 2KB
package.json 2KB
package.json 892B
Contents.json 585B
app.json 69B
Contents.json 63B
LICENSE 1KB
ShoutemAnimationTests.m 2KB
AppDelegate.m 1KB
main.m 510B
README.md 3KB
.npmignore 155B
project.pbxproj 69KB
Info.plist 2KB
Info.plist 2KB
Info.plist 765B
Info.plist 765B
ic_launcher.png 8KB
ic_launcher.png 5KB
ic_launcher.png 3KB
ic_launcher.png 2KB
proguard-rules.pro 3KB
gradle.properties 887B
gradle-wrapper.properties 203B
debug.keystore.properties 105B
MaterialCommunityIcons.ttf 286KB
Rubik-Regular.ttf 215KB
Rubik-Light.ttf 212KB
Rubik-Medium.ttf 211KB
Rubik-Bold.ttf 208KB
Rubik-Italic.ttf 207KB
Rubik-Black.ttf 207KB
Rubik-LightItalic.ttf 203KB
Rubik-MediumItalic.ttf 189KB
Rubik-BlackItalic.ttf 188KB
Rubik-BoldItalic.ttf 187KB
FontAwesome.ttf 162KB
Ionicons.ttf 141KB
MaterialIcons.ttf 125KB
Entypo.ttf 64KB
Foundation.ttf 56KB
SimpleLineIcons.ttf 53KB
Octicons.ttf 27KB
共 110 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功