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
7c23eded
Commit
7c23eded
authored
Feb 12, 2016
by
Hixie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SawTooth
parent
5b8b9812
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
35 deletions
+25
-35
curves.dart
packages/flutter/lib/src/animation/curves.dart
+10
-0
progress_indicator.dart
packages/flutter/lib/src/material/progress_indicator.dart
+15
-35
No files found.
packages/flutter/lib/src/animation/curves.dart
View file @
7c23eded
...
...
@@ -28,6 +28,16 @@ class Linear implements Curve {
double
transform
(
double
t
)
=>
t
;
}
/// A sawtooth curve that repeats a given number of times over the unit interval.
class
SawTooth
implements
Curve
{
const
SawTooth
(
this
.
count
);
final
int
count
;
double
transform
(
double
t
)
{
t
*=
count
;
return
t
-
t
.
truncateToDouble
();
}
}
/// A curve that is 0.0 until start, then curved from 0.0 to 1.0 at end, then 1.0.
class
Interval
implements
Curve
{
const
Interval
(
this
.
start
,
this
.
end
,
{
this
.
curve
:
Curves
.
linear
});
...
...
packages/flutter/lib/src/material/progress_indicator.dart
View file @
7c23eded
...
...
@@ -191,42 +191,22 @@ class CircularProgressIndicator extends ProgressIndicator {
_CircularProgressIndicatorState
createState
()
=>
new
_CircularProgressIndicatorState
();
}
// This class assumes that the incoming animation is a linear 0.0..1.0.
class
_RepeatingCurveTween
extends
Animatable
<
double
>
{
_RepeatingCurveTween
({
this
.
curve
,
this
.
repeats
});
Curve
curve
;
int
repeats
;
double
evaluate
(
Animation
<
double
>
animation
)
{
double
t
=
animation
.
value
;
t
*=
repeats
;
t
-=
t
.
truncateToDouble
();
if
(
t
==
0.0
||
t
==
1.0
)
{
assert
(
curve
.
transform
(
t
).
round
()
==
t
);
return
t
;
}
return
curve
.
transform
(
t
);
}
}
// Tweens used by circular progress indicator
final
_RepeatingCurveTween
_kStrokeHeadTween
=
new
_RepeatingCurveTween
(
curve:
new
Interval
(
0.0
,
0.5
,
curve:
Curves
.
fastOutSlowIn
),
repeats:
5
);
final
_RepeatingCurveTween
_kStrokeTailTween
=
new
_RepeatingCurveTween
(
curve:
new
Interval
(
0.5
,
1.0
,
curve:
Curves
.
fastOutSlowIn
),
repeats:
5
);
final
StepTween
_kStepTween
=
new
StepTween
(
begin:
0
,
end:
5
);
final
_RepeatingCurveTween
_kRotationTween
=
new
_RepeatingCurveTween
(
curve:
Curves
.
linear
,
repeats:
5
);
final
Animatable
<
double
>
_kStrokeHeadTween
=
new
CurveTween
(
curve:
new
Interval
(
0.0
,
0.5
,
curve:
Curves
.
fastOutSlowIn
)
).
chain
(
new
CurveTween
(
curve:
new
SawTooth
(
5
)
));
final
Animatable
<
double
>
_kStrokeTailTween
=
new
CurveTween
(
curve:
new
Interval
(
0.5
,
1.0
,
curve:
Curves
.
fastOutSlowIn
)
).
chain
(
new
CurveTween
(
curve:
new
SawTooth
(
5
)
));
final
Animatable
<
int
>
_kStepTween
=
new
StepTween
(
begin:
0
,
end:
5
);
final
Animatable
<
double
>
_kRotationTween
=
new
CurveTween
(
curve:
new
SawTooth
(
5
));
class
_CircularProgressIndicatorState
extends
State
<
CircularProgressIndicator
>
{
AnimationController
_animationController
;
...
...
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