SlideShare a Scribd company logo
Fun with
Flutter Animations
Divyanshu Bhargava
@divyanshub024, HighLevel
What is Animation?
A sequence of images or frames.
Source: adriennewollman
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
“To think creatively, we must be
able to look afresh at what we
normally take for granted”
- George Keller
“Animation is about creating the
illusion of life. And you can't create it
if you don't have one.”
- Brad Bird
Why Animations are important?
Loading...
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Story of Progress Bar
Progress Bar
Is just an indicator to show
something is happening on the
device.
Brad A. Myres
It does not matter if progress
bar gives you accurate progress.
What matters was that a
progress is there.
Examples
Examples by me
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Base concepts of animation
Animations Type
Tween Animation Physics-based Animation
- In-between.
- Models path between start and
end point.
- curve that defines the timing and
speed of the transition
- Animations with resemble
real-world behavior.
- Whenever possible, apply
real-world physics so they are
natural-looking.
Linear Curve Fling Spring
3 pillars of animation
Ticker Animation Animation
Controller
Animation<T> class
- An animation with a value of type T.
- Animation is nothing else but a value that change in a life span.
- Value change can be linear or curve
AnimationController class
- A controller for an animation.
- Can start, stop, repeat animation.
- Set the animation to a specific value.
- Define the upperBound and lowerBound
values of an animation. (default 0.0 - 1.0)
- Duration of animation.
- Needs Ticker Provider
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Ticker class
- Calls its callback once per animation frame.
- around 60 times per second.
Curves
Animation
widgets
Implicit
Animated
widget
Explicit
Animated
widget
- AnimatedBuilder
- AlignTransition
- DecoratedBoxTransition
- DefaultTextStyleTransition
- PositionedTransition
- more...
- AnimatedAlign
- AnimatedContainer
- AnimatedDefaultTextStyle
- AnimatedOpacity
- AnimatedPadding
- more...
You need to
provide Animation
Controller
Manage own
Animation Controller
Implicit Animation
Color bgColor = Colors.redAccent;
return Scaffold(
body: Container(
color: bgColor,
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.autorenew),
onPressed: () { },
),
);
Color bgColor = Colors.redAccent;
return Scaffold(
body: Container(
color: bgColor,
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.autorenew),
onPressed: () {
setState(() {
bgColor = Colors.deepPurpleAccent;
});
},
),
);
Color bgColor = Colors.redAccent;
return Scaffold(
body: Container(
color: bgColor,
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.autorenew),
onPressed: () {
setState(() {
bgColor = Colors.deepPurpleAccent;
});
},
),
);
Color bgColor = Colors.redAccent;
return Scaffold(
body: AnimatedContainer(
color: bgColor,
duration: Duration(milliseconds: 500),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.autorenew),
onPressed: () {
setState(() {
bgColor = Colors.deepPurpleAccent;
});
},
),
);
Color bgColor = Colors.redAccent;
return Scaffold(
body: AnimatedContainer(
color: bgColor,
duration: Duration(milliseconds: 500),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.autorenew),
onPressed: () {
setState(() {
bgColor = Colors.deepPurpleAccent;
});
},
),
);
Color bgColor = Colors.redAccent;
return Scaffold(
body: AnimatedContainer(
color: bgColor,
duration: Duration(milliseconds: 500),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.autorenew),
onPressed: () {
setState(() {
bgColor = Colors.deepPurpleAccent;
_height = 100;
_width = 100;
_radius = 100.0;
});
},
),
);
Tween Animation Builder
return Scaffold(
body: TweenAnimationBuilder(
tween: ColorTween(
begin: Colors.redAccent,
end: Colors.deepPurpleAccent,
),
duration: Duration(milliseconds: 500),
builder: (context, value, child) {
return Container(
color: value,
);
},
),
);
Hero Animation
https://flutter.dev/docs/development/ui/animations/hero-animations
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
// First Screen
child: Hero(
tag: ‘'imageHero',
child: Image.network(
'https://picsum.photos/250?image=9',
),
),
// Second Screen
child: Hero(
tag: 'imageHero',
child: Image.network(
'https://picsum.photos/250?image=9',
),
),
Explicit Animation
Animated Builder
class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {
AnimationController _controller;
void initState() {
_controller = AnimationController(
vsync: this,
duration: Duration(seconds: 3),
);
_controller.forward();
super.initState();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
}
Animatable<Color> background = TweenSequence<Color>([
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(
begin: color1,
end: color2,
),
),
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(
begin: color2,
end: color3,
),
),
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(
begin: color3,
end: color4,
),
),
]);
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _controller,
builder: (context, widget) => Container(
color: background.evaluate(_controller),
),
);
}
void initState() {
_controller = AnimationController(
vsync: this,
duration: Duration(seconds: 3),
)..repeat();
}
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _controller,
builder: (context, widget) => Container(
color: background.evaluate(_controller),
),
);
}
builder: (context, child) {
final double color =
pageController.hasClients ? pageController.page /
3 : 0.0;
return DecoratedBox(
decoration: BoxDecoration(
color: background.evaluate(
AlwaysStoppedAnimation(color),
),
),
child: PageView.builder(
controller: pageController,
itemCount: places.length,
itemBuilder: (context, index) {
return Center(
child: Text('Page $index'),
);
},
),
);
},
builder: (context, child) {
final double color =
pageController.hasClients ? pageController.page /
3 : 0.0;
return DecoratedBox(
decoration: BoxDecoration(
color: background.evaluate(
AlwaysStoppedAnimation(color),
),
),
child: PageView.builder(
controller: pageController,
itemCount: places.length,
itemBuilder: (context, index) {
return Center(
child: Text('Page $index'),
);
},
),
);
},
builder: (context, child) {
final double color =
pageController.hasClients ? pageController.page /
3 : 0.0;
return DecoratedBox(
decoration: BoxDecoration(
color: background.evaluate(
AlwaysStoppedAnimation(color),
),
),
child: PageView.builder(
controller: pageController,
itemCount: places.length,
itemBuilder: (context, index) {
return Center(
child: Text('Page $index'),
);
},
),
);
},
child: PageView.builder(
controller: pageController,
itemCount: places.length,
itemBuilder: (context, index) {
return CustomCard(
assetName: places[index].assetName,
title: places[index].title,
description: places[index].description,
offset: 0.0,
);
},
),
child: PageTransformer(
pageViewBuilder: (context, visibilityResolver) {
return PageView.builder(
controller: pageController,
itemCount: places.length,
itemBuilder: (context, index) {
return CustomCard(
assetName: places[index].assetName,
title: places[index].title,
description: places[index].description,
offset: visibilityResolver
.resolvePageVisibility(index)
.pagePosition,
);
},
);
},
),
Canvas Animation
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
class CrossPainter extends CustomPainter {
final double fraction;
var _crossPaint;
CrossPainter({this.fraction}) {
_crossPaint = Paint()
..color = crossColor
..strokeWidth = 12.0
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round;
}
@override
bool shouldRepaint(CrossPainter oldDelegate) {
return oldDelegate.fraction != fraction;
}
@override
void paint(Canvas canvas, Size size) {
double leftLineFraction, rightLineFraction;
if (fraction < .5) {
leftLineFraction = fraction / .5;
rightLineFraction = 0.0;
} else {
leftLineFraction = 1.0;
rightLineFraction = (fraction - .5) / .5;
}
}
canvas.drawLine(
Offset(0.0, 0.0),
Offset(size.width * leftLineFraction, size.height *
leftLineFraction),
_crossPaint);
if (fraction >= .5) {
canvas.drawLine(
Offset(size.width, 0.0),
Offset(size.width - size.width * rightLineFraction,
size.height * rightLineFraction),
_crossPaint);
}
class CirclePainter extends CustomPainter {
final double fraction;
var _circlePaint;
@override
void paint(Canvas canvas, Size size) {
var rect = Offset(0.0, 0.0) & size;
canvas.drawArc(rect, -pi / 2, pi * 2 * fraction, false,
_circlePaint);
}
@override
bool shouldRepaint(CirclePainter oldDelegate) {
return oldDelegate.fraction != fraction;
}
}
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
Navigation Transition
To Push: Android
To Push: iOS
class ScaleRoute extends PageRouteBuilder {
final Widget page;
ScaleRoute({this.page}) : super (
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) => page,
transitionDuration: Duration(seconds: 2),
transitionsBuilder: (context, animation, secondaryAnimation, child
) =>
ScaleTransition(
scale: Tween<double>(
begin: 0.0,
end: 1.0,
).animate(
CurvedAnimation(
parent: animation,
curve: Curves.fastOutSlowIn,
),
),
child: child,
),
);
}
Navigator.push(
context,
ScaleRoute(page: SecondPage()),
);
class ScaleRotateRoute extends PageRouteBuilder {
final Widget page;
ScaleRotateRoute({this.page})
: super(
pageBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) =>
page,
transitionDuration: Duration(seconds: 1),
transitionsBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) =>
ScaleTransition(
scale: Tween<double>(
begin: 0.0,
end: 1.0,
).animate(
CurvedAnimation(
parent: animation,
curve: Curves.fastOutSlowIn,
),
),
child: RotationTransition(
turns: Tween<double>(
begin: 0.0,
end: 1.0,
).animate(
CurvedAnimation(
parent: animation,
curve: Curves.linear,
),
),
child: child,
),
),
Navigator.push(
context,
ScaleRotateRoute(page: SecondPage()),
);
Physics Based Animations
Spring Simulation
- A spring simulation.
- Models a particle attached to a spring that follows Hooke's law.
- “Hooke's law states that the force (F) needed to extend or compress a
spring by some distance x scales linearly with respect to that distance.”
- F = Kx
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return GestureDetector(
onPanDown: (details) { _controller.stop() },
onPanUpdate: (details) {
setState(() {
_dragAlignment += Alignment(
details.delta.dx / (size.width / 2),
details.delta.dy / (size.height / 2),
);
});
},
onPanEnd: (details) {
_runAnimation(details.velocity.pixelsPerSecond, size);
},
child: Align(
alignment: _dragAlignment,
child: Card(
child: widget.child,
),
),
);
}
void _runAnimation(Offset pixelsPerSecond, Size size) {
_animation = _controller.drive(
AlignmentTween(
begin: _dragAlignment,
end: Alignment.center
,),);
final unitsPerSecondX = pixelsPerSecond.dx / size.width;
final unitsPerSecondY = pixelsPerSecond.dy / size.height;
final unitsPerSecond = Offset(unitsPerSecondX,
unitsPerSecondY);
final unitVelocity = unitsPerSecond.distance;
const spring = SpringDescription(
mass: 30,
stiffness: 1,
damping: 1,
);
final simulation = SpringSimulation(spring, 0, 1, -unitVelocity);
_controller.animateWith(simulation);
}
void _runAnimation(Offset pixelsPerSecond, Size size) {
_animation = _controller.drive(
AlignmentTween(
begin: _dragAlignment,
end: Alignment.center
,),);
final unitsPerSecondX = pixelsPerSecond.dx / size.width;
final unitsPerSecondY = pixelsPerSecond.dy / size.height;
final unitsPerSecond = Offset(unitsPerSecondX,
unitsPerSecondY);
final unitVelocity = unitsPerSecond.distance;
const spring = SpringDescription(
mass: 30,
stiffness: 1,
damping: 1,
);
final simulation = SpringSimulation(spring, 0, 1, -unitVelocity);
_controller.animateWith(simulation);
}
Bonus: Flare
What is Flare?
Flare is a powerful design and animation tool, which allows
designers and developers to easily add high-quality animation
to their apps and games.
Flare examples
- Real assets.
- No rebuilding in code.
- Manipulate anything at runtime.
- Open source.
Why Flare matters?
What’s Next?
Thank You
‫תודה‬
Divyanshu Bhargava
@divyanshub024, HighLevel
Ad

More Related Content

Similar to Fun with flutter animations - Divyanshu Bhargava, GoHighLevel (20)

Animate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica JordanAnimate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica Jordan
Jessica Jordan
 
How to Animate a Widget Across Screens in Flutter.pptx
How to Animate a Widget Across Screens in Flutter.pptxHow to Animate a Widget Across Screens in Flutter.pptx
How to Animate a Widget Across Screens in Flutter.pptx
RubenGray1
 
Expand/Collapse animation on Android
Expand/Collapse animation on AndroidExpand/Collapse animation on Android
Expand/Collapse animation on Android
Pavlo Dudka
 
How to make a video game
How to make a video gameHow to make a video game
How to make a video game
dandylion13
 
A practical intro to BabylonJS
A practical intro to BabylonJSA practical intro to BabylonJS
A practical intro to BabylonJS
HansRontheWeb
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy Values
Juriy Zaytsev
 
JavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptJavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScript
Laurence Svekis ✔
 
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficientTh 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Bin Shao
 
On the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxOn the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docx
dunhamadell
 
How to Create Animation Using the AnimatedAlign Widget.pptx
How to Create Animation Using the AnimatedAlign Widget.pptxHow to Create Animation Using the AnimatedAlign Widget.pptx
How to Create Animation Using the AnimatedAlign Widget.pptx
RubenGray1
 
Creating an Uber Clone - Part XXII.pdf
Creating an Uber Clone - Part XXII.pdfCreating an Uber Clone - Part XXII.pdf
Creating an Uber Clone - Part XXII.pdf
ShaiAlmog1
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 Canvas
Henry Osborne
 
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCsStandford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
彼得潘 Pan
 
Android animations
Android animationsAndroid animations
Android animations
Kumar
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
fredharris32
 
Houdini - What lies ahead
Houdini - What lies aheadHoudini - What lies ahead
Houdini - What lies ahead
Arun Michael Dsouza
 
Model View Intent on Android
Model View Intent on AndroidModel View Intent on Android
Model View Intent on Android
Cody Engel
 
UI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdfUI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdf
ShaiAlmog1
 
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
anistar sung
 
Ubuntu app development
Ubuntu app development Ubuntu app development
Ubuntu app development
Xiaoguo Liu
 
Animate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica JordanAnimate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica Jordan
Jessica Jordan
 
How to Animate a Widget Across Screens in Flutter.pptx
How to Animate a Widget Across Screens in Flutter.pptxHow to Animate a Widget Across Screens in Flutter.pptx
How to Animate a Widget Across Screens in Flutter.pptx
RubenGray1
 
Expand/Collapse animation on Android
Expand/Collapse animation on AndroidExpand/Collapse animation on Android
Expand/Collapse animation on Android
Pavlo Dudka
 
How to make a video game
How to make a video gameHow to make a video game
How to make a video game
dandylion13
 
A practical intro to BabylonJS
A practical intro to BabylonJSA practical intro to BabylonJS
A practical intro to BabylonJS
HansRontheWeb
 
Fabric.js @ Falsy Values
Fabric.js @ Falsy ValuesFabric.js @ Falsy Values
Fabric.js @ Falsy Values
Juriy Zaytsev
 
JavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptJavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScript
Laurence Svekis ✔
 
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficientTh 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Th 0230 turbo_chargeyourui-howtomakeyourandroidu_ifastandefficient
Bin Shao
 
On the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxOn the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docx
dunhamadell
 
How to Create Animation Using the AnimatedAlign Widget.pptx
How to Create Animation Using the AnimatedAlign Widget.pptxHow to Create Animation Using the AnimatedAlign Widget.pptx
How to Create Animation Using the AnimatedAlign Widget.pptx
RubenGray1
 
Creating an Uber Clone - Part XXII.pdf
Creating an Uber Clone - Part XXII.pdfCreating an Uber Clone - Part XXII.pdf
Creating an Uber Clone - Part XXII.pdf
ShaiAlmog1
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 Canvas
Henry Osborne
 
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCsStandford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
Standford 2015 week4: 1.Protocols and Delegation, Gestures 2. Multiple MVCs
彼得潘 Pan
 
Android animations
Android animationsAndroid animations
Android animations
Kumar
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
fredharris32
 
Model View Intent on Android
Model View Intent on AndroidModel View Intent on Android
Model View Intent on Android
Cody Engel
 
UI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdfUI Design From Scratch - Part 5 - transcript.pdf
UI Design From Scratch - Part 5 - transcript.pdf
ShaiAlmog1
 
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
anistar sung
 
Ubuntu app development
Ubuntu app development Ubuntu app development
Ubuntu app development
Xiaoguo Liu
 

More from DroidConTLV (20)

Mobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, NikeMobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, Nike
DroidConTLV
 
Doing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra TechnologiesDoing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra Technologies
DroidConTLV
 
No more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola SolutionsNo more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola Solutions
DroidConTLV
 
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.comMobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
DroidConTLV
 
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, ClimacellLiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
DroidConTLV
 
MVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, LightricksMVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, Lightricks
DroidConTLV
 
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
DroidConTLV
 
Building Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice NinjaBuilding Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice Ninja
DroidConTLV
 
New Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy ZukanovNew Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy Zukanov
DroidConTLV
 
Designing a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, GettDesigning a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, Gett
DroidConTLV
 
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, PepperThe Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
DroidConTLV
 
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDevKotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
DroidConTLV
 
Flutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, TikalFlutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, Tikal
DroidConTLV
 
DroidconTLV 2019
DroidconTLV 2019DroidconTLV 2019
DroidconTLV 2019
DroidConTLV
 
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, MondayOk google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
DroidConTLV
 
Introduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, WixIntroduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, Wix
DroidConTLV
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
DroidConTLV
 
Educating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz TamirEducating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz Tamir
DroidConTLV
 
Constraint-ly motion - making your app dance - John Hoford, Google
Constraint-ly motion - making your app dance - John Hoford, GoogleConstraint-ly motion - making your app dance - John Hoford, Google
Constraint-ly motion - making your app dance - John Hoford, Google
DroidConTLV
 
Who needs MVVM? Architecture components & MVP - Timor Surkis, Colu
Who needs MVVM? Architecture components & MVP - Timor Surkis, ColuWho needs MVVM? Architecture components & MVP - Timor Surkis, Colu
Who needs MVVM? Architecture components & MVP - Timor Surkis, Colu
DroidConTLV
 
Mobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, NikeMobile Development in the Information Age - Yossi Elkrief, Nike
Mobile Development in the Information Age - Yossi Elkrief, Nike
DroidConTLV
 
Doing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra TechnologiesDoing work in the background - Darryn Campbell, Zebra Technologies
Doing work in the background - Darryn Campbell, Zebra Technologies
DroidConTLV
 
No more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola SolutionsNo more video loss - Alex Rivkin, Motorola Solutions
No more video loss - Alex Rivkin, Motorola Solutions
DroidConTLV
 
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.comMobile at Scale: from startup to a big company - Dor Samet, Booking.com
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
DroidConTLV
 
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, ClimacellLiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
DroidConTLV
 
MVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, LightricksMVVM In real life - Lea Cohen Tannoudji, Lightricks
MVVM In real life - Lea Cohen Tannoudji, Lightricks
DroidConTLV
 
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
DroidConTLV
 
Building Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice NinjaBuilding Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice Ninja
DroidConTLV
 
New Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy ZukanovNew Android Project: The Most Important Decisions - Vasiliy Zukanov
New Android Project: The Most Important Decisions - Vasiliy Zukanov
DroidConTLV
 
Designing a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, GettDesigning a Design System - Shai Mishali, Gett
Designing a Design System - Shai Mishali, Gett
DroidConTLV
 
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, PepperThe Mighty Power of the Accessibility Service - Guy Griv, Pepper
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
DroidConTLV
 
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDevKotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
DroidConTLV
 
Flutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, TikalFlutter State Management - Moti Bartov, Tikal
Flutter State Management - Moti Bartov, Tikal
DroidConTLV
 
DroidconTLV 2019
DroidconTLV 2019DroidconTLV 2019
DroidconTLV 2019
DroidConTLV
 
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, MondayOk google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
DroidConTLV
 
Introduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, WixIntroduction to React Native - Lev Vidrak, Wix
Introduction to React Native - Lev Vidrak, Wix
DroidConTLV
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
DroidConTLV
 
Educating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz TamirEducating your app – adding ML edge to your apps - Maoz Tamir
Educating your app – adding ML edge to your apps - Maoz Tamir
DroidConTLV
 
Constraint-ly motion - making your app dance - John Hoford, Google
Constraint-ly motion - making your app dance - John Hoford, GoogleConstraint-ly motion - making your app dance - John Hoford, Google
Constraint-ly motion - making your app dance - John Hoford, Google
DroidConTLV
 
Who needs MVVM? Architecture components & MVP - Timor Surkis, Colu
Who needs MVVM? Architecture components & MVP - Timor Surkis, ColuWho needs MVVM? Architecture components & MVP - Timor Surkis, Colu
Who needs MVVM? Architecture components & MVP - Timor Surkis, Colu
DroidConTLV
 
Ad

Recently uploaded (20)

Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Ad

Fun with flutter animations - Divyanshu Bhargava, GoHighLevel

  • 1. Fun with Flutter Animations Divyanshu Bhargava @divyanshub024, HighLevel
  • 2. What is Animation? A sequence of images or frames.
  • 5. “To think creatively, we must be able to look afresh at what we normally take for granted” - George Keller “Animation is about creating the illusion of life. And you can't create it if you don't have one.” - Brad Bird
  • 6. Why Animations are important?
  • 10. Progress Bar Is just an indicator to show something is happening on the device.
  • 11. Brad A. Myres It does not matter if progress bar gives you accurate progress. What matters was that a progress is there.
  • 15. Base concepts of animation
  • 16. Animations Type Tween Animation Physics-based Animation - In-between. - Models path between start and end point. - curve that defines the timing and speed of the transition - Animations with resemble real-world behavior. - Whenever possible, apply real-world physics so they are natural-looking. Linear Curve Fling Spring
  • 17. 3 pillars of animation Ticker Animation Animation Controller
  • 18. Animation<T> class - An animation with a value of type T. - Animation is nothing else but a value that change in a life span. - Value change can be linear or curve
  • 19. AnimationController class - A controller for an animation. - Can start, stop, repeat animation. - Set the animation to a specific value. - Define the upperBound and lowerBound values of an animation. (default 0.0 - 1.0) - Duration of animation. - Needs Ticker Provider
  • 21. Ticker class - Calls its callback once per animation frame. - around 60 times per second.
  • 23. Animation widgets Implicit Animated widget Explicit Animated widget - AnimatedBuilder - AlignTransition - DecoratedBoxTransition - DefaultTextStyleTransition - PositionedTransition - more... - AnimatedAlign - AnimatedContainer - AnimatedDefaultTextStyle - AnimatedOpacity - AnimatedPadding - more... You need to provide Animation Controller Manage own Animation Controller
  • 25. Color bgColor = Colors.redAccent; return Scaffold( body: Container( color: bgColor, ), floatingActionButton: FloatingActionButton( child: Icon(Icons.autorenew), onPressed: () { }, ), );
  • 26. Color bgColor = Colors.redAccent; return Scaffold( body: Container( color: bgColor, ), floatingActionButton: FloatingActionButton( child: Icon(Icons.autorenew), onPressed: () { setState(() { bgColor = Colors.deepPurpleAccent; }); }, ), );
  • 27. Color bgColor = Colors.redAccent; return Scaffold( body: Container( color: bgColor, ), floatingActionButton: FloatingActionButton( child: Icon(Icons.autorenew), onPressed: () { setState(() { bgColor = Colors.deepPurpleAccent; }); }, ), );
  • 28. Color bgColor = Colors.redAccent; return Scaffold( body: AnimatedContainer( color: bgColor, duration: Duration(milliseconds: 500), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.autorenew), onPressed: () { setState(() { bgColor = Colors.deepPurpleAccent; }); }, ), );
  • 29. Color bgColor = Colors.redAccent; return Scaffold( body: AnimatedContainer( color: bgColor, duration: Duration(milliseconds: 500), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.autorenew), onPressed: () { setState(() { bgColor = Colors.deepPurpleAccent; }); }, ), );
  • 30. Color bgColor = Colors.redAccent; return Scaffold( body: AnimatedContainer( color: bgColor, duration: Duration(milliseconds: 500), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.autorenew), onPressed: () { setState(() { bgColor = Colors.deepPurpleAccent; _height = 100; _width = 100; _radius = 100.0; }); }, ), );
  • 32. return Scaffold( body: TweenAnimationBuilder( tween: ColorTween( begin: Colors.redAccent, end: Colors.deepPurpleAccent, ), duration: Duration(milliseconds: 500), builder: (context, value, child) { return Container( color: value, ); }, ), );
  • 38. // First Screen child: Hero( tag: ‘'imageHero', child: Image.network( 'https://picsum.photos/250?image=9', ), ), // Second Screen child: Hero( tag: 'imageHero', child: Image.network( 'https://picsum.photos/250?image=9', ), ),
  • 41. class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin { AnimationController _controller; void initState() { _controller = AnimationController( vsync: this, duration: Duration(seconds: 3), ); _controller.forward(); super.initState(); } @override void dispose() { _controller.dispose(); super.dispose(); } }
  • 42. Animatable<Color> background = TweenSequence<Color>([ TweenSequenceItem( weight: 1.0, tween: ColorTween( begin: color1, end: color2, ), ), TweenSequenceItem( weight: 1.0, tween: ColorTween( begin: color2, end: color3, ), ), TweenSequenceItem( weight: 1.0, tween: ColorTween( begin: color3, end: color4, ), ), ]);
  • 43. @override Widget build(BuildContext context) { return AnimatedBuilder( animation: _controller, builder: (context, widget) => Container( color: background.evaluate(_controller), ), ); }
  • 44. void initState() { _controller = AnimationController( vsync: this, duration: Duration(seconds: 3), )..repeat(); } @override Widget build(BuildContext context) { return AnimatedBuilder( animation: _controller, builder: (context, widget) => Container( color: background.evaluate(_controller), ), ); }
  • 45. builder: (context, child) { final double color = pageController.hasClients ? pageController.page / 3 : 0.0; return DecoratedBox( decoration: BoxDecoration( color: background.evaluate( AlwaysStoppedAnimation(color), ), ), child: PageView.builder( controller: pageController, itemCount: places.length, itemBuilder: (context, index) { return Center( child: Text('Page $index'), ); }, ), ); },
  • 46. builder: (context, child) { final double color = pageController.hasClients ? pageController.page / 3 : 0.0; return DecoratedBox( decoration: BoxDecoration( color: background.evaluate( AlwaysStoppedAnimation(color), ), ), child: PageView.builder( controller: pageController, itemCount: places.length, itemBuilder: (context, index) { return Center( child: Text('Page $index'), ); }, ), ); },
  • 47. builder: (context, child) { final double color = pageController.hasClients ? pageController.page / 3 : 0.0; return DecoratedBox( decoration: BoxDecoration( color: background.evaluate( AlwaysStoppedAnimation(color), ), ), child: PageView.builder( controller: pageController, itemCount: places.length, itemBuilder: (context, index) { return Center( child: Text('Page $index'), ); }, ), ); },
  • 48. child: PageView.builder( controller: pageController, itemCount: places.length, itemBuilder: (context, index) { return CustomCard( assetName: places[index].assetName, title: places[index].title, description: places[index].description, offset: 0.0, ); }, ),
  • 49. child: PageTransformer( pageViewBuilder: (context, visibilityResolver) { return PageView.builder( controller: pageController, itemCount: places.length, itemBuilder: (context, index) { return CustomCard( assetName: places[index].assetName, title: places[index].title, description: places[index].description, offset: visibilityResolver .resolvePageVisibility(index) .pagePosition, ); }, ); }, ),
  • 53. class CrossPainter extends CustomPainter { final double fraction; var _crossPaint; CrossPainter({this.fraction}) { _crossPaint = Paint() ..color = crossColor ..strokeWidth = 12.0 ..style = PaintingStyle.stroke ..strokeCap = StrokeCap.round; } @override bool shouldRepaint(CrossPainter oldDelegate) { return oldDelegate.fraction != fraction; }
  • 54. @override void paint(Canvas canvas, Size size) { double leftLineFraction, rightLineFraction; if (fraction < .5) { leftLineFraction = fraction / .5; rightLineFraction = 0.0; } else { leftLineFraction = 1.0; rightLineFraction = (fraction - .5) / .5; } }
  • 55. canvas.drawLine( Offset(0.0, 0.0), Offset(size.width * leftLineFraction, size.height * leftLineFraction), _crossPaint); if (fraction >= .5) { canvas.drawLine( Offset(size.width, 0.0), Offset(size.width - size.width * rightLineFraction, size.height * rightLineFraction), _crossPaint); }
  • 56. class CirclePainter extends CustomPainter { final double fraction; var _circlePaint; @override void paint(Canvas canvas, Size size) { var rect = Offset(0.0, 0.0) & size; canvas.drawArc(rect, -pi / 2, pi * 2 * fraction, false, _circlePaint); } @override bool shouldRepaint(CirclePainter oldDelegate) { return oldDelegate.fraction != fraction; } }
  • 62. class ScaleRoute extends PageRouteBuilder { final Widget page; ScaleRoute({this.page}) : super ( pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) => page, transitionDuration: Duration(seconds: 2), transitionsBuilder: (context, animation, secondaryAnimation, child ) => ScaleTransition( scale: Tween<double>( begin: 0.0, end: 1.0, ).animate( CurvedAnimation( parent: animation, curve: Curves.fastOutSlowIn, ), ), child: child, ), ); }
  • 64. class ScaleRotateRoute extends PageRouteBuilder { final Widget page; ScaleRotateRoute({this.page}) : super( pageBuilder: ( BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, ) => page, transitionDuration: Duration(seconds: 1), transitionsBuilder: ( BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child, ) =>
  • 65. ScaleTransition( scale: Tween<double>( begin: 0.0, end: 1.0, ).animate( CurvedAnimation( parent: animation, curve: Curves.fastOutSlowIn, ), ), child: RotationTransition( turns: Tween<double>( begin: 0.0, end: 1.0, ).animate( CurvedAnimation( parent: animation, curve: Curves.linear, ), ), child: child, ), ),
  • 68. Spring Simulation - A spring simulation. - Models a particle attached to a spring that follows Hooke's law. - “Hooke's law states that the force (F) needed to extend or compress a spring by some distance x scales linearly with respect to that distance.” - F = Kx
  • 69. @override Widget build(BuildContext context) { final size = MediaQuery.of(context).size; return GestureDetector( onPanDown: (details) { _controller.stop() }, onPanUpdate: (details) { setState(() { _dragAlignment += Alignment( details.delta.dx / (size.width / 2), details.delta.dy / (size.height / 2), ); }); }, onPanEnd: (details) { _runAnimation(details.velocity.pixelsPerSecond, size); }, child: Align( alignment: _dragAlignment, child: Card( child: widget.child, ), ), ); }
  • 70. void _runAnimation(Offset pixelsPerSecond, Size size) { _animation = _controller.drive( AlignmentTween( begin: _dragAlignment, end: Alignment.center ,),); final unitsPerSecondX = pixelsPerSecond.dx / size.width; final unitsPerSecondY = pixelsPerSecond.dy / size.height; final unitsPerSecond = Offset(unitsPerSecondX, unitsPerSecondY); final unitVelocity = unitsPerSecond.distance; const spring = SpringDescription( mass: 30, stiffness: 1, damping: 1, ); final simulation = SpringSimulation(spring, 0, 1, -unitVelocity); _controller.animateWith(simulation); }
  • 71. void _runAnimation(Offset pixelsPerSecond, Size size) { _animation = _controller.drive( AlignmentTween( begin: _dragAlignment, end: Alignment.center ,),); final unitsPerSecondX = pixelsPerSecond.dx / size.width; final unitsPerSecondY = pixelsPerSecond.dy / size.height; final unitsPerSecond = Offset(unitsPerSecondX, unitsPerSecondY); final unitVelocity = unitsPerSecond.distance; const spring = SpringDescription( mass: 30, stiffness: 1, damping: 1, ); final simulation = SpringSimulation(spring, 0, 1, -unitVelocity); _controller.animateWith(simulation); }
  • 73. What is Flare? Flare is a powerful design and animation tool, which allows designers and developers to easily add high-quality animation to their apps and games.
  • 75. - Real assets. - No rebuilding in code. - Manipulate anything at runtime. - Open source. Why Flare matters?