Skip to content

Commit 5c69bd0

Browse files
committed
Added property getters
1 parent 381963c commit 5c69bd0

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

src/gameobjects/components/TransformMatrix.js

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,117 @@ var TransformMatrix = new Class({
6060
};
6161
},
6262

63+
a: {
64+
65+
get: function ()
66+
{
67+
return this.matrix[0];
68+
},
69+
70+
set: function (value)
71+
{
72+
this.matrix[0] = value;
73+
}
74+
75+
},
76+
77+
b: {
78+
79+
get: function ()
80+
{
81+
return this.matrix[1];
82+
},
83+
84+
set: function (value)
85+
{
86+
this.matrix[1] = value;
87+
}
88+
89+
},
90+
91+
c: {
92+
93+
get: function ()
94+
{
95+
return this.matrix[2];
96+
},
97+
98+
set: function (value)
99+
{
100+
this.matrix[2] = value;
101+
}
102+
103+
},
104+
105+
d: {
106+
107+
get: function ()
108+
{
109+
return this.matrix[3];
110+
},
111+
112+
set: function (value)
113+
{
114+
this.matrix[3] = value;
115+
}
116+
117+
},
118+
119+
tx: {
120+
121+
get: function ()
122+
{
123+
return this.matrix[4];
124+
},
125+
126+
set: function (value)
127+
{
128+
this.matrix[4] = value;
129+
}
130+
131+
},
132+
133+
ty: {
134+
135+
get: function ()
136+
{
137+
return this.matrix[5];
138+
},
139+
140+
set: function (value)
141+
{
142+
this.matrix[5] = value;
143+
}
144+
145+
},
146+
147+
rotation: {
148+
149+
get: function ()
150+
{
151+
return Math.acos(this.a / this.scaleX) * (Math.atan(-this.c / this.a) < 0 ? -1 : 1);
152+
}
153+
154+
},
155+
156+
scaleX: {
157+
158+
get: function ()
159+
{
160+
return Math.sqrt((this.a * this.a) + (this.c * this.c));
161+
}
162+
163+
},
164+
165+
scaleY: {
166+
167+
get: function ()
168+
{
169+
return Math.sqrt((this.b * this.b) + (this.d * this.d));
170+
}
171+
172+
},
173+
63174
/**
64175
* [description]
65176
*

0 commit comments

Comments
 (0)