SlideShare a Scribd company logo
How to
Implement
React Native
Animations
Using Animated
API
www.bacancytechnology.com
Table of contents
1. Introduction
2. Tutorial Goal: Learn to Implement
React Native Animations
3. Working with React Native
Animations
4. Steps to Quickly Add Animations in
React Native App
5. Conclusion
Introduction
Animations are an essential part of a UX
of an application. Animations
significantly impact the user for a better
interaction experience and smoothen the
user engagement. Whenever there is an
extended functionality to perform, the
animation is a great idea to engage users.
Animation has a movement from the
static state to the state of motion for
better user interaction. Animations have
various transitions to show elements and
thus make it enjoyable.
You might be tempted to implement
React Native Animations using animated
API, and maybe you are searching for
how to get started with React Native
animations. Here is a step-by-step guide
on adding React Native animations from
scratch.
Tutorial
Goal: Learn
to
Implement
React Native
Animations
We will learn about how to get started
with React Native Animation using the
React Native’s Animated library. The
video is the final output of advanced
animations in React Native.
Watch Video
The main workflow is to create an
Animated Value and use it for different
components. We will be discussing the
following React Native Animation Types
also:
Please add some information to these
points as well
Animated.timing()
It allows us to define an animation to a
specific value over a certain amount of
time.
Animated.spring()
It allows us to define animation from
start points to endpoints without
defining time as we did in timing.
Animated.parallel()
It allows us to have all the defined
animations in the array to trigger at the
same time.
Animated.sequence()
It allows us to have all the defined
animations in the array to trigger one
after another.
Working
with React
Native
Animations
We will start the animation by using the
start() function to our animation-type
methods.
start() takes a completion callback called
when the animation task is completed,
creating an infinite animation.
Using start function with
Animated.timing() :-
Animated.timing(value,{}).start()
Animated.timing() will take two
parameters here, a value and an object.
The object can take values such as
toValue, duration, opacity, etc.
Another parameter we will be using is
useNativeDriver.The native driver helps
send out everything about the animation
to the native code before animation
starts, through which native code can
perform the Animation UI on the thread.
Use this in the animation configuration:
useNativeDriver: true
There are multiple React Native
Animatable components and only these
components can be animated.
Animated.View
Animated.Image
Animated.FlatList
Animated.SectionList
Animated.Text
Animated.ScrollView
Steps to
Quickly Add
Animations
in React
Native App
The entire source code is available here –
Github repo
Creating a React Native App
Initially, we will create a react native app
using:
react-native init Animation
Installing dependencies for Navigation
Install stack navigation for navigating
screens using:
npm install react-native-gesture-handler
react-native-safe-area-context @react-
navigation/native
@react-navigation/stack.
Creating Components
We will create basic animation screens such
as-
1. Fade Animation
2. Spin Animation
3. Scale Animation
4. Spring Animation
5. Parallel Animation
6. Sequence Animation
And a main.js file in which we will import all
these screens for navigating.
We will pass the type of animation of the
component in useEffect() as the argument,
so whenever we navigate to the screen
respective component is rendered
immediately based on the type.
Fade Animation
This screen will create an animation on the
image component, which fades in on render.
Create an Animated.Value() for animation
every time to make component animatable :
const Fade= new Animated.Value(0)
We will call Animated.timing() in
useEffect(). The purpose of
Animated.Timing() is to change the input
value to a specified output value after a
certain amount of time.
useEffect(()=>{
Animated.timing(Fade,{
toValue:1,
duration:3000,
useNativeDriver: true
}).start()
},[Fade])
Animated.Timing() takes the first argument
as the value which needs to be updated; a
second argument is an object containing
three values. The first value toValue:1
updates the value of Fade to 1. The second
argument duration:3000 is the specific
amount of time after which it should reflect
animation, and the third argument is
useNativeDriver: true, which I have
explained above.
< Animated.Image
style=
{{marginTop:5,height:200,width:200,opacity
:Fade,}}
source={{ uri:
"https://images.unsplash.com/photo-
1541963463532-d68292c34b19?ixlib=rb-
1.2.1&#038;ixid=MXwxMjA3fDB8MHxleHBs
b3JlLWZlZWR8M3x8fGVufDB8fHw%3D&#0
38;w=1000&#038;q=80" }}
>
< /Animated.Image >
opacity:Fade takes the value of Fade to
implement animation after the duration of
3000ms.
Spin Animation
Spin animation rotates and makes the
component spin according to the output
degree values.
const Spin= new Animated.Value(0)
const SpinValue= Spin.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg']
})
Interpolation: Interpolation is a way to
estimate function at intermediate points
defined from input range and output range.
We can change colors, rotate and scale the
animation component using interpolation.
useEffect(()=>{
Animated.timing(Spin,{
toValue:1,
duration:3000,
useNativeDriver:true
}).start()
},[Spin])
< Animated.Image
style=
{{height:150,width:180,marginTop:8,borderR
adius:20,transform:[{rotate:SpinValue}]}}
source={{ uri:
"https://images.unsplash.com/photo-
1541963463532-d68292c34b19?ixlib=rb-
1.2.1&#038;ixid=MXwxMjA3fDB8MHxleHBs
b3JlLWZlZWR8M3x8fGVufDB8fHw%3D&#0
38;w=1000&#038;q=80" }}
>
< /Animated.Image >
We have used transform configuration in
the image style, which suggests rotating
with the parameter SpinValue as output
range of 360 degrees defined with the
interpolation above.
Create Scaling Animations in React Native
Scale animation grows and expands the
component.
const Scale= new Animated.Value(0)
const ScaleValue= Scale.interpolate({
inputRange: [0, 1],
outputRange: [1, 2]
})
useEffect(()=>{
Animated.timing(Scale,{
toValue:1,
duration:3000,
useNativeDriver:true
}).start()
},[Scale])
< Animated.Image
style={{height:100,width:130,transform:
[{scale:ScaleValue}]}}
source={{ uri:
"https://images.unsplash.com/photo-
1541963463532-d68292c34b19?ixlib=rb-
1.2.1&ixid=MXwxMjA3fDB8MHxleHBsb3JlL
WZlZWR8M3x8fGVufDB8fHw%3D&w=100
0&q=80" }}
>
< /Animated.Image >
We have used transform configuration in
the image style, which suggests scaling with
the parameter ScaleValue of specified
output range defined with the interpolation
above.
Spring Animation
Spring Animation is like what spring looks
like when it’s in motion.
const Spring= new Animated.Value(0.2)
useEffect(()=>{
Animated.spring(Spring,{
toValue:1.1,
friction:1,
useNativeDriver:true}).start()
},[Spring])
Here Animated.spring() animation takes a
configuration similar to the
Animated.timing() instead of duration it
uses friction and tension as the physics
spring model.
< Animated.Image
style={{height:150,width:180,transform:
[{scale:Spring}]}}
source={{ uri:
"https://images.unsplash.com/photo-
1541963463532-d68292c34b19?ixlib=rb-
1.2.1&ixid=MXwxMjA3fDB8MHxleHBsb3JlL
WZlZWR8M3x8fGVufDB8fHw%3D&w=100
0&q=80" }}
>
< /Animated.Image >
Parallel Animation
Parallel animation takes an array of
different Animation type configurations to
animinate them parallelly.
Here we are taking three different
animatable components,i.e., Scale, spring,
and rotate, to make them animate
parallelly.
Initializing animated values with
interpolation for three scenario:
const Scale = new Animated.Value(0)
const ScaleValue = Scale.interpolate({
inputRange: [0, 1],
outputRange: [-3, 2]
});
const Spin = new Animated.Value(0)
const SpinValue = Spin.interpolate({
inputRange: [0, 1],
outputRange: ["0deg", "360deg"]
});
const SpringVal = new Animated.Value(1)
Starting Animation for parallel animation
type in use effect:
useEffect(() => {
Animated.parallel(
[
Animated.timing(Scale, {
toValue: 1,
duration: 3000,
useNativeDriver: true
}), //scaling
Animated.spring(SpringVal, {
toValue: 2,
friction: 1,
tension: 0.5,
useNativeDriver: true
}), //spring
Animated.timing(Spin, {
toValue: 1,
duration: 3000,
useNativeDriver: true
}) //spin
])
.start()
}, [Scale, SpringVal, Spin])
Rendering Animated components(View and
text) on the screen with types:
< Animated.View
style={{ height: 50, width: 80,
backgroundColor: 'red',
transform: [{ scaleX: ScaleValue }] }}
>
What's up
Welcome here !!
< /Animated.Text >
Sequence Animation
Sequence Animation takes an array of
different Animation type configurations
and animates them one by one after the
previous one ends.
Here we are taking three different
animatable components,i.e., Scale, spring,
and rotate, to make them animate
sequentially; everything else is similar to
parallel animation.
Initializing steps will be similar to the
parallel except the starting of the animation
component.It uses Animated.sequence()
type in useeffect :
useEffect(() => {
Animated.sequence(
[
Animated.timing(Scale, {
toValue: 1,
duration: 3000,
useNativeDriver: true
}), //scaling
Animated.spring(SpringValue, {
toValue: 2,
friction: 1,
tension: 0.5,
useNativeDriver: true
}), //spring
Animated.timing(Spin, {
toValue: 1,
duration: 3000,
useNativeDriver: true
}) //spin
]).start()
}, [Scale, SpringValue, Spin])
Conclusion
This was all about how to implement React
Native Animations using Animated API
scratch. Animations make your application
presentable and due to which users enjoy
interaction with your app. If you are looking
for a helping hand to animate your React
Native App within the project, then get in
touch with us to leverage our top-notch
React native app development expertise.
We also let you hire React Native developer
at your ease and convenience with your
preferable engagement model.
Thank You
www.bacancytechnology.com

More Related Content

PDF
[Android] Android Animation
PDF
Introduction to Android Animations
PDF
How to build a react native app with the help of react native hooks
PPTX
JQuery - Effect - Animate method
PDF
2%20-%20Scripting%20Tutorial
PDF
13 top react native animation libraries to create stellar ux
PDF
React Native Animation
PPTX
Academy PRO: React native - publish
[Android] Android Animation
Introduction to Android Animations
How to build a react native app with the help of react native hooks
JQuery - Effect - Animate method
2%20-%20Scripting%20Tutorial
13 top react native animation libraries to create stellar ux
React Native Animation
Academy PRO: React native - publish

Similar to How to implement react native animations using animated api (20)

PPTX
Ilya Ivanov - Advanced React-Native
PPTX
Top React Animation Libraries by Angular Minds
PPTX
Academy PRO: React native - miscellaneous
PPTX
React Native: Introduction
PDF
Best react native animation libraries &amp; ui component of 2022
PPTX
React native introduction
PPTX
JS Fest 2018. Илья Иванов. Введение в React-Native
PDF
Which Tools Do React Native Developers Use to Create Interactive User Interfa...
PDF
Animations in React
PDF
"React Native" by Vanessa Leo e Roberto Brogi
PDF
React native: building native iOS apps with javascript
PDF
Introduction to react native
PDF
10 Ways to Boost the Performance of React Native Apps.pdf
PDF
Philip Shurpik "Architecting React Native app"
PPTX
React native by example by Vadim Ruban
PDF
Lessons from a year of building apps with React Native
PDF
How to Create Custom Animations in Flutter – A Step-by-Step Guide.pdf
PDF
Introduzione a React Native - Facebook Developer Circle Rome
ODP
Android App Development - 12 animations
PDF
The ultimate guide to optimize your react native app performance in 2022
Ilya Ivanov - Advanced React-Native
Top React Animation Libraries by Angular Minds
Academy PRO: React native - miscellaneous
React Native: Introduction
Best react native animation libraries &amp; ui component of 2022
React native introduction
JS Fest 2018. Илья Иванов. Введение в React-Native
Which Tools Do React Native Developers Use to Create Interactive User Interfa...
Animations in React
"React Native" by Vanessa Leo e Roberto Brogi
React native: building native iOS apps with javascript
Introduction to react native
10 Ways to Boost the Performance of React Native Apps.pdf
Philip Shurpik "Architecting React Native app"
React native by example by Vadim Ruban
Lessons from a year of building apps with React Native
How to Create Custom Animations in Flutter – A Step-by-Step Guide.pdf
Introduzione a React Native - Facebook Developer Circle Rome
Android App Development - 12 animations
The ultimate guide to optimize your react native app performance in 2022
Ad

More from Katy Slemon (20)

PDF
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
PDF
Data Science Use Cases in Retail & Healthcare Industries.pdf
PDF
How Much Does It Cost To Hire Golang Developer.pdf
PDF
What’s New in Flutter 3.pdf
PDF
Why Use Ruby On Rails.pdf
PDF
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
PDF
How to Implement Middleware Pipeline in VueJS.pdf
PDF
How to Build Laravel Package Using Composer.pdf
PDF
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
PDF
How to Develop Slack Bot Using Golang.pdf
PDF
IoT Based Battery Management System in Electric Vehicles.pdf
PDF
Understanding Flexbox Layout in React Native.pdf
PDF
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
PDF
New Features in iOS 15 and Swift 5.5.pdf
PDF
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
PDF
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
PDF
Flutter Performance Tuning Best Practices From the Pros.pdf
PDF
Angular Universal How to Build Angular SEO Friendly App.pdf
PDF
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
PDF
Ruby On Rails Performance Tuning Guide.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdf
How Much Does It Cost To Hire Golang Developer.pdf
What’s New in Flutter 3.pdf
Why Use Ruby On Rails.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How to Implement Middleware Pipeline in VueJS.pdf
How to Build Laravel Package Using Composer.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
How to Develop Slack Bot Using Golang.pdf
IoT Based Battery Management System in Electric Vehicles.pdf
Understanding Flexbox Layout in React Native.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
New Features in iOS 15 and Swift 5.5.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
Flutter Performance Tuning Best Practices From the Pros.pdf
Angular Universal How to Build Angular SEO Friendly App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
Ruby On Rails Performance Tuning Guide.pdf
Ad

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPT
Teaching material agriculture food technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Sensors and Actuators in IoT Systems using pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
“AI and Expert System Decision Support & Business Intelligence Systems”
Teaching material agriculture food technology
20250228 LYD VKU AI Blended-Learning.pptx
Empathic Computing: Creating Shared Understanding
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Sensors and Actuators in IoT Systems using pdf
MYSQL Presentation for SQL database connectivity
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
madgavkar20181017ppt McKinsey Presentation.pdf
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
GamePlan Trading System Review: Professional Trader's Honest Take

How to implement react native animations using animated api