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
d0ad775e
Commit
d0ad775e
authored
Sep 02, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove lerp.dart
These functions are now in sky:dart.
parent
11ee06dd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
97 deletions
+19
-97
card_collection.dart
examples/widgets/card_collection.dart
+1
-2
ensure_visible.dart
examples/widgets/ensure_visible.dart
+1
-2
overlay_geometry.dart
examples/widgets/overlay_geometry.dart
+1
-2
pageable_list.dart
examples/widgets/pageable_list.dart
+1
-2
animated_value.dart
packages/flutter/lib/animation/animated_value.dart
+2
-3
lerp.dart
packages/flutter/lib/base/lerp.dart
+0
-72
box_painter.dart
packages/flutter/lib/painting/box_painter.dart
+7
-8
animated_container.dart
packages/flutter/lib/src/widgets/animated_container.dart
+6
-6
No files found.
examples/widgets/card_collection.dart
View file @
d0ad775e
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/base/lerp.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/theme/typography.dart'
as
typography
;
import
'package:sky/widgets.dart'
;
...
...
@@ -34,7 +33,7 @@ class CardCollectionApp extends App {
48.0
,
63.0
,
82.0
,
146.0
,
60.0
,
55.0
,
84.0
,
96.0
,
50.0
];
cardModels
=
new
List
.
generate
(
cardHeights
.
length
,
(
i
)
{
Color
color
=
lerpColor
(
colors
.
Red
[
300
],
colors
.
Blue
[
900
],
i
/
cardHeights
.
length
);
Color
color
=
Color
.
lerp
(
colors
.
Red
[
300
],
colors
.
Blue
[
900
],
i
/
cardHeights
.
length
);
return
new
CardModel
(
i
,
cardHeights
[
i
],
color
);
});
super
.
initState
();
...
...
examples/widgets/ensure_visible.dart
View file @
d0ad775e
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/base/lerp.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/widgets.dart'
;
...
...
@@ -34,7 +33,7 @@ class EnsureVisibleApp extends App {
48.0
,
63.0
,
82.0
,
146.0
,
60.0
,
55.0
,
84.0
,
96.0
,
50.0
];
cardModels
=
new
List
.
generate
(
cardHeights
.
length
,
(
i
)
{
Color
color
=
lerpColor
(
colors
.
Red
[
300
],
colors
.
Blue
[
900
],
i
/
cardHeights
.
length
);
Color
color
=
Color
.
lerp
(
colors
.
Red
[
300
],
colors
.
Blue
[
900
],
i
/
cardHeights
.
length
);
return
new
CardModel
(
i
,
cardHeights
[
i
],
color
);
});
...
...
examples/widgets/overlay_geometry.dart
View file @
d0ad775e
...
...
@@ -4,7 +4,6 @@
import
'dart:sky'
as
sky
;
import
'package:sky/base/lerp.dart'
;
import
'package:sky/rendering.dart'
;
import
'package:sky/theme/colors.dart'
as
colors
;
import
'package:sky/widgets.dart'
;
...
...
@@ -83,7 +82,7 @@ class OverlayGeometryApp extends App {
48.0
,
63.0
,
82.0
,
146.0
,
60.0
,
55.0
,
84.0
,
96.0
,
50.0
];
cardModels
=
new
List
.
generate
(
cardHeights
.
length
,
(
i
)
{
Color
color
=
lerpColor
(
colors
.
Red
[
300
],
colors
.
Blue
[
900
],
i
/
cardHeights
.
length
);
Color
color
=
Color
.
lerp
(
colors
.
Red
[
300
],
colors
.
Blue
[
900
],
i
/
cardHeights
.
length
);
return
new
CardModel
(
i
,
cardHeights
[
i
],
color
);
});
super
.
initState
();
...
...
examples/widgets/pageable_list.dart
View file @
d0ad775e
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:sky/base/lerp.dart'
;
import
'package:sky/theme/colors.dart'
;
import
'package:sky/widgets.dart'
;
...
...
@@ -33,7 +32,7 @@ class PageableListApp extends App {
.
toList
();
cardModels
=
new
List
.
generate
(
cardSizes
.
length
,
(
i
)
{
Color
color
=
lerpColor
(
Red
[
300
],
Blue
[
900
],
i
/
cardSizes
.
length
);
Color
color
=
Color
.
lerp
(
Red
[
300
],
Blue
[
900
],
i
/
cardSizes
.
length
);
return
new
CardModel
(
i
,
cardSizes
[
i
],
color
);
});
...
...
packages/flutter/lib/animation/animated_value.dart
View file @
d0ad775e
...
...
@@ -6,7 +6,6 @@ import "dart:sky";
import
'package:sky/animation/curves.dart'
;
import
'package:sky/animation/direction.dart'
;
import
'package:sky/base/lerp.dart'
;
export
'package:sky/animation/curves.dart'
show
Interval
;
...
...
@@ -89,12 +88,12 @@ class AnimatedColorValue extends AnimatedValue<Color> {
AnimatedColorValue
(
Color
begin
,
{
Color
end
,
Curve
curve
})
:
super
(
begin
,
end:
end
,
curve:
curve
);
Color
lerp
(
double
t
)
=>
lerpColor
(
begin
,
end
,
t
);
Color
lerp
(
double
t
)
=>
Color
.
lerp
(
begin
,
end
,
t
);
}
class
AnimatedRect
extends
AnimatedValue
<
Rect
>
{
AnimatedRect
(
Rect
begin
,
{
Rect
end
,
Curve
curve
})
:
super
(
begin
,
end:
end
,
curve:
curve
);
Rect
lerp
(
double
t
)
=>
lerpRect
(
begin
,
end
,
t
);
Rect
lerp
(
double
t
)
=>
Rect
.
lerp
(
begin
,
end
,
t
);
}
packages/flutter/lib/base/lerp.dart
deleted
100644 → 0
View file @
11ee06dd
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:sky'
;
/// Linearly interpolate between two numbers.
num
lerpNum
(
num
a
,
num
b
,
double
t
)
{
if
(
a
==
null
&&
b
==
null
)
return
null
;
if
(
a
==
null
)
a
=
0.0
;
if
(
b
==
null
)
b
=
0.0
;
return
a
+
(
b
-
a
)
*
t
;
}
Color
_scaleAlpha
(
Color
a
,
double
factor
)
{
return
a
.
withAlpha
((
a
.
alpha
*
factor
).
round
());
}
/// Linearly interpolate between two [Color] objects.
///
/// If either color is null, this function linearly interpolates from a
/// transparent instance of othe other color.
Color
lerpColor
(
Color
a
,
Color
b
,
double
t
)
{
if
(
a
==
null
&&
b
==
null
)
return
null
;
if
(
a
==
null
)
return
_scaleAlpha
(
b
,
t
);
if
(
b
==
null
)
return
_scaleAlpha
(
a
,
1.0
-
t
);
return
new
Color
.
fromARGB
(
lerpNum
(
a
.
alpha
,
b
.
alpha
,
t
).
toInt
(),
lerpNum
(
a
.
red
,
b
.
red
,
t
).
toInt
(),
lerpNum
(
a
.
green
,
b
.
green
,
t
).
toInt
(),
lerpNum
(
a
.
blue
,
b
.
blue
,
t
).
toInt
()
);
}
/// Linearly interpolate between two [Offset] objects.
///
/// If either offset is null, this function interpolates from [Offset.zero].
Offset
lerpOffset
(
Offset
a
,
Offset
b
,
double
t
)
{
if
(
a
==
null
&&
b
==
null
)
return
null
;
if
(
a
==
null
)
return
b
*
t
;
if
(
b
==
null
)
return
a
*
(
1.0
-
t
);
return
new
Offset
(
lerpNum
(
a
.
dx
,
b
.
dx
,
t
),
lerpNum
(
a
.
dy
,
b
.
dy
,
t
));
}
/// Linearly interpolate between two [Rect] objects.
///
/// If either rect is null, this function interpolates from 0x0x0x0.
Rect
lerpRect
(
Rect
a
,
Rect
b
,
double
t
)
{
if
(
a
==
null
&&
b
==
null
)
return
null
;
if
(
a
==
null
)
return
new
Rect
.
fromLTRB
(
b
.
left
*
t
,
b
.
top
*
t
,
b
.
right
*
t
,
b
.
bottom
*
t
);
if
(
b
==
null
)
{
double
k
=
1.0
-
t
;
return
new
Rect
.
fromLTRB
(
b
.
left
*
k
,
b
.
top
*
k
,
b
.
right
*
k
,
b
.
bottom
*
k
);
}
return
new
Rect
.
fromLTRB
(
lerpNum
(
a
.
left
,
b
.
left
,
t
),
lerpNum
(
a
.
top
,
b
.
top
,
t
),
lerpNum
(
a
.
right
,
b
.
right
,
t
),
lerpNum
(
a
.
bottom
,
b
.
bottom
,
t
)
);
}
packages/flutter/lib/painting/box_painter.dart
View file @
d0ad775e
...
...
@@ -7,7 +7,6 @@ import 'dart:sky' as sky;
import
'dart:sky'
show
Point
,
Offset
,
Size
,
Rect
,
Color
,
Paint
,
Path
;
import
'package:sky/base/image_resource.dart'
;
import
'package:sky/base/lerp.dart'
;
import
'package:sky/painting/shadows.dart'
;
/// An immutable set of offsets in each of the four cardinal directions
...
...
@@ -197,9 +196,9 @@ class BoxShadow {
if
(
b
==
null
)
return
a
.
scale
(
1.0
-
t
);
return
new
BoxShadow
(
color:
lerpColor
(
a
.
color
,
b
.
color
,
t
),
offset:
lerpOffset
(
a
.
offset
,
b
.
offset
,
t
),
blur:
lerpNum
(
a
.
blur
,
b
.
blur
,
t
)
color:
Color
.
lerp
(
a
.
color
,
b
.
color
,
t
),
offset:
Offset
.
lerp
(
a
.
offset
,
b
.
offset
,
t
),
blur:
sky
.
lerpDouble
(
a
.
blur
,
b
.
blur
,
t
)
);
}
...
...
@@ -521,10 +520,10 @@ class BoxDecoration {
BoxDecoration
scale
(
double
factor
)
{
// TODO(abarth): Scale ALL the things.
return
new
BoxDecoration
(
backgroundColor:
lerpColor
(
null
,
backgroundColor
,
factor
),
backgroundColor:
Color
.
lerp
(
null
,
backgroundColor
,
factor
),
backgroundImage:
backgroundImage
,
border:
border
,
borderRadius:
lerpNum
(
null
,
borderRadius
,
factor
),
borderRadius:
sky
.
lerpDouble
(
null
,
borderRadius
,
factor
),
boxShadow:
BoxShadow
.
lerpList
(
null
,
boxShadow
,
factor
),
gradient:
gradient
,
shape:
shape
...
...
@@ -543,10 +542,10 @@ class BoxDecoration {
return
a
.
scale
(
1.0
-
t
);
// TODO(abarth): lerp ALL the fields.
return
new
BoxDecoration
(
backgroundColor:
lerpColor
(
a
.
backgroundColor
,
b
.
backgroundColor
,
t
),
backgroundColor:
Color
.
lerp
(
a
.
backgroundColor
,
b
.
backgroundColor
,
t
),
backgroundImage:
b
.
backgroundImage
,
border:
b
.
border
,
borderRadius:
lerpNum
(
a
.
borderRadius
,
b
.
borderRadius
,
t
),
borderRadius:
sky
.
lerpDouble
(
a
.
borderRadius
,
b
.
borderRadius
,
t
),
boxShadow:
BoxShadow
.
lerpList
(
a
.
boxShadow
,
b
.
boxShadow
,
t
),
gradient:
b
.
gradient
,
shape:
b
.
shape
...
...
packages/flutter/lib/src/widgets/animated_container.dart
View file @
d0ad775e
...
...
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'
package:vector_math/vector_math.dart'
;
import
'
dart:sky'
as
sky
;
import
'package:vector_math/vector_math.dart'
;
import
'package:sky/animation/animated_value.dart'
;
import
'package:sky/animation/animation_performance.dart'
;
import
'package:sky/animation/curves.dart'
;
import
'package:sky/base/lerp.dart'
;
import
'package:sky/painting/box_painter.dart'
;
import
'package:sky/src/widgets/animated_component.dart'
;
import
'package:sky/src/widgets/basic.dart'
;
...
...
@@ -34,10 +34,10 @@ class AnimatedEdgeDimsValue extends AnimatedValue<EdgeDims> {
EdgeDims
lerp
(
double
t
)
{
return
new
EdgeDims
(
lerpNum
(
begin
.
top
,
end
.
top
,
t
),
lerpNum
(
begin
.
right
,
end
.
right
,
t
),
lerpNum
(
begin
.
bottom
,
end
.
bottom
,
t
),
lerpNum
(
begin
.
bottom
,
end
.
left
,
t
)
sky
.
lerpDouble
(
begin
.
top
,
end
.
top
,
t
),
sky
.
lerpDouble
(
begin
.
right
,
end
.
right
,
t
),
sky
.
lerpDouble
(
begin
.
bottom
,
end
.
bottom
,
t
),
sky
.
lerpDouble
(
begin
.
bottom
,
end
.
left
,
t
)
);
}
}
...
...
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