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
b636d54e
Commit
b636d54e
authored
Aug 07, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds skew property to sprite node
parent
e691a63e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
node.dart
packages/flutter/example/game/lib/node.dart
+28
-0
No files found.
packages/flutter/example/game/lib/node.dart
View file @
b636d54e
...
...
@@ -30,6 +30,9 @@ class Node {
double
_scaleX
=
1.0
;
double
_scaleY
=
1.0
;
double
_skewX
=
0.0
;
double
_skewY
=
0.0
;
/// The visibility of this node and its children.
bool
visible
=
true
;
...
...
@@ -116,6 +119,22 @@ class Node {
invalidateTransformMatrix
();
}
double
get
skewX
=>
_skewX
;
void
set
skewX
(
double
skewX
)
{
assert
(
skewX
!=
null
);
_skewX
=
skewX
;
invalidateTransformMatrix
();
}
double
get
skewY
=>
_skewY
;
void
set
skewY
(
double
skewY
)
{
assert
(
skewY
!=
null
);
_skewY
=
skewY
;
invalidateTransformMatrix
();
}
/// The draw order of this node compared to its parent and its siblings.
///
/// By default nodes are drawn in the order that they have been added to a parent. To override this behavior the
...
...
@@ -295,6 +314,15 @@ class Node {
0.0
,
0.0
,
1.0
,
0.0
,
_position
.
x
,
_position
.
y
,
0.0
,
1.0
);
if
(
_skewX
!=
0.0
||
_skewY
!=
0.0
)
{
// Needs skew transform
Matrix4
skew
=
new
Matrix4
(
1.0
,
math
.
tan
(
radians
(
_skewX
)),
0.0
,
0.0
,
math
.
tan
(
radians
(
_skewY
)),
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
);
matrix
.
multiply
(
skew
);
}
return
matrix
;
}
...
...
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