-
Notifications
You must be signed in to change notification settings - Fork 0
/
DOMMatrixReadOnly.cljs
293 lines (227 loc) · 7.79 KB
/
DOMMatrixReadOnly.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
(ns web.dom.DOMMatrixReadOnly
"The DOMMatrixReadOnly interface represents a 4x4 matrix, suitable
2D and 3D operations. If this interface defines only read-only
the `web.dom.DOMMatrix` interface which inherits from it, add
the properties and the methods to allow to have modifiable matrices."
(:refer-clojure :exclude []))
(def constructor
"Constructor.
The DOMMatrixReadOnly constructor creates a new `web.dom.DOMMatrixReadOnly` object which represents 4x4 matrices, suitable for 2D and 3D operations.
init Optional
\\tEither a string containing a sequence of numbers or an array of integers specifying the matrix you want to create.
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly/DOMMatrixReadOnly`"
js/DOMMatrixReadOnly)
(defn flip-x
"Method.
The flipX() method of the `web.dom.DOMMatrixReadOnly` interface
a new matrix being the result of the original matrix flipped
the x-axis.
`DOMMatrix.flipX()`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly/flipX`"
[this ]
(-> this (.flipX)))
(defn flip-y
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being flipped around the y-axis, that is
by the DOMMatrix(1, 0, 0, -1, 0, 0). The original matrix is not"
[this & args]
(-> this .-flipY (.apply this (clj->js args))))
(defn inverse
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being inverted. The original matrix is not
If the matrix cannot be inverted, all its components are set
NaN and is2D() returns false."
[this & args]
(-> this .-inverse (.apply this (clj->js args))))
(defn multiply
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being multiplied by the given DOMMatrix.
original matrix is not modified."
[this & args]
(-> this .-multiply (.apply this (clj->js args))))
(defn rotate-axis-angle
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being rotated by the given angle and the
vector. The original matrix is not modified."
[this & args]
(-> this .-rotateAxisAngle (.apply this (clj->js args))))
(defn rotate
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being rotated by the given angle, with the
centered on the origin given. The original matrix is not modified."
[this & args]
(-> this .-rotate (.apply this (clj->js args))))
(defn rotate-from-vector
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being rotated by the angle between the given
and (1,0), centered on the origin given. The original matrix
not modified."
[this & args]
(-> this .-rotateFromVector (.apply this (clj->js args))))
(defn scale
"Method.
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly/scale`"
[this & args]
(-> this .-scale (.apply this (clj->js args))))
(defn scale3d
"Method.
Returns a DOMMatrix containing a new matrix being the result
the matrix x, y and z dimension being scaled by the given factor,
on the origin given. The original matrix is not modified."
[this & args]
(-> this .-scale3d (.apply this (clj->js args))))
(defn scale-non-uniform
"Method.
Returns a DOMMatrix containing a new matrix being the result
the matrix x, y and z dimension being scaled by the given factor
each dimension, centered on the origin given. The original matrix
not modified."
[this & args]
(-> this .-scaleNonUniform (.apply this (clj->js args))))
(defn skew-x
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being skewed along the x-axis by the given
The original matrix is not modified."
[this & args]
(-> this .-skewX (.apply this (clj->js args))))
(defn skew-y
"Method.
Returns a DOMMatrix containing a new matrix being the result
the original matrix being skewed along the y-axis by the given
The original matrix is not modified."
[this & args]
(-> this .-skewY (.apply this (clj->js args))))
(defn to-float32array
"Method.
Returns a Float32Array containing the 6 components (a, b, c,
e, f) in the case of a 2D matrix or the 16 components (m11, m12,
m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)
a 3D matrix."
[this & args]
(-> this .-toFloat32Array (.apply this (clj->js args))))
(defn to-float64array
"Method.
Returns a Float64Array containing the 6 components (a, b, c,
e, f) in the case of a 2D matrix or the 16 components (m11, m12,
m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44)
a 3D matrix."
[this & args]
(-> this .-toFloat64Array (.apply this (clj->js args))))
(defn to-json
"Method.
Returns a JSON representation of the DOMMatrixReadOnly object."
[this & args]
(-> this .-toJSON (.apply this (clj->js args))))
(defn to-string
"Method.
Returns a DOMString containing the 6 components separated by
',' and prefixed by the CSS matrix functional notation, as 'matrix
b, c, d, e, f)', in the case of a 2D matrix or matrix3d functional
and the 16 components,'matrix3d(m11, m12, m13, m14, m21, m22,
m24, m31, m32, m33, m34, m41, m42, m43, m44)', for a 3D matrix."
[this & args]
(-> this .-toString (.apply this (clj->js args))))
(defn transform-point
"Method.
Returns a DOMPoint that is the point given in parameter multiplied
the matrix. But the original point and the matrix aren't modified."
[this & args]
(-> this .-transformPoint (.apply this (clj->js args))))
(defn translate
"Method.
The translate() method of the `web.dom.DOMMatrixReadOnly` interface
a new matrix being the result of the original matrix with a translation
`The translate() method accepts two or three values.
DOMMatrix.translate(translateX, translateY[, translateZ])`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly/translate`"
[this & args]
(-> this .-translate (.apply this (clj->js args))))
(defn m11
"Property.
Are double representing each component of a 4x4 matrix. They
read-only, but their counterpart, with the same name, in DOMMatrix"
[this]
(-> this (.-m11)))
(defn set-m11!
"Property.
Are double representing each component of a 4x4 matrix. They
read-only, but their counterpart, with the same name, in DOMMatrix"
[this val]
(aset this "m11" val))
(defn a
"Property.
Are double representing each component of a 4x4 matrix needed
2D rotations and translations. They are aliases for some components
the 4x4 matrix:
2D
3D equivalent
a
m11
b
m12
c
m21
d
m22
e
m41
f
m42
They are read-only, but their counterpart, with the same name,
DOMMatrix aren't."
[this]
(-> this (.-a)))
(defn set-a!
"Property.
Are double representing each component of a 4x4 matrix needed
2D rotations and translations. They are aliases for some components
the 4x4 matrix:
2D
3D equivalent
a
m11
b
m12
c
m21
d
m22
e
m41
f
m42
They are read-only, but their counterpart, with the same name,
DOMMatrix aren't."
[this val]
(aset this "a" val))
(defn is2d
"Property.
Is a Boolean indicating if the matrix contains a 2D matrix and
accept 2D transformations."
[this]
(-> this (.-is2D)))
(defn set-is2d!
"Property.
Is a Boolean indicating if the matrix contains a 2D matrix and
accept 2D transformations."
[this val]
(aset this "is2D" val))
(defn is-identity
"Property.
Is a Boolean indincating if the matrix identity, that is a matrix
1 on the components of its diagonal, and 0 elsewhere."
[this]
(-> this (.-isIdentity)))
(defn set-is-identity!
"Property.
Is a Boolean indincating if the matrix identity, that is a matrix
1 on the components of its diagonal, and 0 elsewhere."
[this val]
(aset this "isIdentity" val))