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
52324758
Commit
52324758
authored
Aug 11, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #567 from vlidholt/master
Adds API docs to sprite ColorSequence and Layer
parents
e053b35c
db8bdbe6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
color_secuence.dart
examples/game/lib/color_secuence.dart
+14
-0
layer.dart
examples/game/lib/layer.dart
+16
-0
No files found.
examples/game/lib/color_secuence.dart
View file @
52324758
part of
sprites
;
part of
sprites
;
/// A sequence of colors representing a gradient or a color transition over
/// time. The sequence is represented by a list of [colors] and a list of
/// [colorStops], the stops are normalized values (0.0 to 1.0) and ordered in
/// the list. Both lists have the same number of elements.
class
ColorSequence
{
class
ColorSequence
{
/// List of colors.
List
<
Color
>
colors
;
List
<
Color
>
colors
;
/// List of color stops, normalized values (0.0 to 1.0) and ordered.
List
<
double
>
colorStops
;
List
<
double
>
colorStops
;
/// Creates a new color sequence from a list of [colors] and a list of
/// [colorStops].
ColorSequence
(
this
.
colors
,
this
.
colorStops
)
{
ColorSequence
(
this
.
colors
,
this
.
colorStops
)
{
assert
(
colors
!=
null
);
assert
(
colors
!=
null
);
assert
(
colorStops
!=
null
);
assert
(
colorStops
!=
null
);
assert
(
colors
.
length
==
colorStops
.
length
);
assert
(
colors
.
length
==
colorStops
.
length
);
}
}
/// Creates a new color sequence from a start and an end color.
ColorSequence
.
fromStartAndEndColor
(
Color
start
,
Color
end
)
{
ColorSequence
.
fromStartAndEndColor
(
Color
start
,
Color
end
)
{
colors
=
[
start
,
end
];
colors
=
[
start
,
end
];
colorStops
=
[
0.0
,
1.0
];
colorStops
=
[
0.0
,
1.0
];
}
}
/// Creates a new color sequence by copying an existing sequence.
ColorSequence
.
copy
(
ColorSequence
sequence
)
{
ColorSequence
.
copy
(
ColorSequence
sequence
)
{
colors
=
new
List
<
Color
>.
from
(
sequence
.
colors
);
colors
=
new
List
<
Color
>.
from
(
sequence
.
colors
);
colorStops
=
new
List
<
double
>.
from
(
sequence
.
colorStops
);
colorStops
=
new
List
<
double
>.
from
(
sequence
.
colorStops
);
}
}
/// Returns the color at a normalized (0.0 to 1.0) position in the color
/// sequence. If a color stop isn't hit, the returned color will be an
/// interpolation of a color between two color stops.
Color
colorAtPosition
(
double
pos
)
{
Color
colorAtPosition
(
double
pos
)
{
assert
(
pos
>=
0.0
&&
pos
<=
1.0
);
assert
(
pos
>=
0.0
&&
pos
<=
1.0
);
...
...
examples/game/lib/layer.dart
View file @
52324758
part of
sprites
;
part of
sprites
;
/// A [Node] that provides an intermediate rendering surface in the sprite
/// rendering tree. A [Layer] can be used to change the opacity, color, or to
/// apply an effect to a set of nodes. All nodes that are children to the
/// [Layer] will be rendered into the surface. If the area that is needed for
/// the children to be drawn is know, the [layerRect] property should be set as
/// this can enhance performance.
class
Layer
extends
Node
with
SpritePaint
{
class
Layer
extends
Node
with
SpritePaint
{
/// The area that the children of the [Layer] will occupy. This value is
/// treated as a hint to the rendering system and may in some cases be
/// ignored. If the area isn't known, the layerRect can be set to [null].
///
/// myLayer.layerRect = new Rect.fromLTRB(0.0, 0.0, 200.0, 100.0);
Rect
layerRect
;
Rect
layerRect
;
/// Creates a new layer. The layerRect can optionally be passed as an argument
/// if it is known.
///
/// var myLayer = new Layer();
Layer
([
Rect
this
.
layerRect
=
null
]);
Layer
([
Rect
this
.
layerRect
=
null
]);
Paint
_cachedPaint
=
new
Paint
()
Paint
_cachedPaint
=
new
Paint
()
...
...
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