Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
9ce6bff5
Commit
9ce6bff5
authored
Mar 01, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2279 from abarth/animation_nits
Minor improvements to AnimationController
parents
bf97313a
08de980a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
animation_controller.dart
packages/flutter/lib/src/animation/animation_controller.dart
+10
-8
No files found.
packages/flutter/lib/src/animation/animation_controller.dart
View file @
9ce6bff5
...
...
@@ -141,10 +141,8 @@ class AnimationController extends Animation<double>
Duration
simulationDuration
=
duration
;
if
(
simulationDuration
==
null
)
{
double
range
=
upperBound
-
lowerBound
;
if
(
range
.
isFinite
)
{
double
remainingFraction
=
(
target
-
_value
).
abs
()
/
range
;
simulationDuration
=
this
.
duration
*
remainingFraction
;
}
double
remainingFraction
=
range
.
isFinite
?
(
target
-
_value
).
abs
()
/
range
:
1.0
;
simulationDuration
=
this
.
duration
*
remainingFraction
;
}
stop
();
if
(
simulationDuration
==
Duration
.
ZERO
)
{
...
...
@@ -154,12 +152,16 @@ class AnimationController extends Animation<double>
}
assert
(
simulationDuration
>
Duration
.
ZERO
);
assert
(!
isAnimating
);
return
_startSimulation
(
new
_
Twee
nSimulation
(
_value
,
target
,
simulationDuration
,
curve
));
return
_startSimulation
(
new
_
Interpolatio
nSimulation
(
_value
,
target
,
simulationDuration
,
curve
));
}
/// Starts running this animation in the forward direction, and
/// restarts the animation when it completes.
Future
repeat
({
double
min:
0.0
,
double
max:
1.0
,
Duration
period
})
{
///
/// Defaults to repeating between the lower and upper bounds.
Future
repeat
({
double
min
,
double
max
,
Duration
period
})
{
min
??=
lowerBound
;
max
??=
upperBound
;
period
??=
duration
;
return
animateWith
(
new
_RepeatingSimulation
(
min
,
max
,
period
));
}
...
...
@@ -226,8 +228,8 @@ class AnimationController extends Animation<double>
}
}
class
_
Twee
nSimulation
extends
Simulation
{
_
Twee
nSimulation
(
this
.
_begin
,
this
.
_end
,
Duration
duration
,
this
.
_curve
)
class
_
Interpolatio
nSimulation
extends
Simulation
{
_
Interpolatio
nSimulation
(
this
.
_begin
,
this
.
_end
,
Duration
duration
,
this
.
_curve
)
:
_durationInSeconds
=
duration
.
inMicroseconds
/
Duration
.
MICROSECONDS_PER_SECOND
{
assert
(
_durationInSeconds
>
0.0
);
assert
(
_begin
!=
null
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment