A native animation UI component for react-native. (Recently, we will refactor and optimize this.)
npm i react-native-animation --save
Podfile
add
pod 'react-native-animation', :path => '../node_modules/react-native-animation'
settings.gradle
add
include ':react-native-animation'
project(':react-native-animation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-animation/android')
A simple example:(fade in)
<Animation.AnimationView
data={[{
type: 'Alpha',
from: 0,
to: 1,
duration: 500,
}]} autoplay={true}>
other views...
</Animation.AnimationView>
*Now support: 'Translate' | 'Rotate' | 'Scale' | 'Alpha'
export interface PropsDefine {
data: AnimationModel[]
style?: React.ViewStyle
autoplay?: boolean
autoclear?: boolean
onStart?: (view: AnimationView) => void
onEnd?: (view: AnimationView) => void
}
start()
clear()
export interface AnimationModel {
name?: string
type: 'Translate' | 'Rotate' | 'Scale' | 'Alpha'
from?: number
to?: number
from2?: number
to2?: number
duration: number
startOffset?: number
interpolator?: 'Linear'
interpolatorData?: number
repeat?: number
}