This is a universal animation library for React Native, powered by Reanimated 2.
Features:
- Universal: works on all platforms
- 60 FPS animations on the native thread
- Mount/unmount animations, likeĀ
framer-motion
- Powered by Reanimated 2
- Web support, out-of-the-box
- Expo support
- Intuitive API
- Variants
- Strong TypeScript support
- Highly-configurable animations
- Sequence animations
- Loop & repeat animations
How to use it:
1. Install and import the moti.
# Yarn $ yarn add moti react-native-reanimated # NPM $ npm i moti react-native-reanimated
import React, { useReducer } from 'react' import { StyleSheet, Pressable } from 'react-native' import { View } from 'moti'
2. Basic usage.
function Shape() { return ( <View from={{ opacity: 0, scale: 0.5, }} animate={{ opacity: 1, scale: 1, }} transition={{ type: 'timing', }} style={styles.shape} /> ) } export default function HelloWorld() { const [visible, toggle] = useReducer((s) => !s, true) return ( <Pressable onPress={toggle} style={styles.container}> {visible && <Shape />} </Pressable> ) } const styles = StyleSheet.create({ shape: { justifyContent: 'center', height: 250, width: 250, borderRadius: 25, marginRight: 10, backgroundColor: 'white', }, container: { flex: 1, alignItems: 'center', justifyContent: 'center', flexDirection: 'row', backgroundColor: '#9c1aff', }, })
Preview:
Download Details:
Author: nandorojo
Live Demo: View The Demo
Download Link: Download The Source Code
Official Website: https://moti.fyi/
License: MIT