-
Notifications
You must be signed in to change notification settings - Fork 0
/
SVGMatrix.cljs
177 lines (130 loc) · 3.77 KB
/
SVGMatrix.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
(ns web.deprecated.SVGMatrix
"Many of SVG's graphics operations utilize 2x3 matrices of the"
(:refer-clojure :exclude []))
(defn multiply
"Method.
Performs matrix multiplication. This matrix is post-multiplied
another matrix, returning the resulting new matrix as SVGMatrix."
[this & args]
(-> this .-multiply (.apply this (clj->js args))))
(defn inverse
"Method.
Returns the inverse matrix as SVGMatrix."
[this & args]
(-> this .-inverse (.apply this (clj->js args))))
(defn translate
"Method.
Post-multiplies a translation transformation on the current matrix
returns the resulting matrix as SVGMatrix."
[this & args]
(-> this .-translate (.apply this (clj->js args))))
(defn scale
"Method.
Post-multiplies a uniform scale transformation on the current
and returns the resulting matrix as SVGMatrix."
[this & args]
(-> this .-scale (.apply this (clj->js args))))
(defn scale-non-uniform
"Method.
Post-multiplies a non-uniform scale transformation on the current
and returns the resulting matrix as SVGMatrix."
[this & args]
(-> this .-scaleNonUniform (.apply this (clj->js args))))
(defn rotate
"Method.
Post-multiplies a rotation transformation on the current matrix
returns the resulting matrix as SVGMatrix."
[this & args]
(-> this .-rotate (.apply this (clj->js args))))
(defn rotate-from-vector
"Method.
Post-multiplies a rotation transformation on the current matrix
returns the resulting matrix as SVGMatrix. The rotation angle
determined by taking (+/-) atan(y/x). The direction of the vector
y) determines whether the positive or negative angle value is"
[this & args]
(-> this .-rotateFromVector (.apply this (clj->js args))))
(defn flip-x
"Method.
Post-multiplies the transformation [-1 0 0 1 0 0] and returns
resulting matrix as SVGMatrix."
[this & args]
(-> this .-flipX (.apply this (clj->js args))))
(defn flip-y
"Method.
Post-multiplies the transformation [1 0 0 -1 0 0] and returns
resulting matrix as SVGMatrix."
[this & args]
(-> this .-flipY (.apply this (clj->js args))))
(defn skew-x
"Method.
Post-multiplies a skewX transformation on the current matrix
returns the resulting matrix as SVGMatrix."
[this & args]
(-> this .-skewX (.apply this (clj->js args))))
(defn skew-y
"Method.
Post-multiplies a skewY transformation on the current matrix
returns the resulting matrix as SVGMatrix."
[this & args]
(-> this .-skewY (.apply this (clj->js args))))
(defn a
"Property.
A float representing the a component of the matrix."
[this]
(-> this (.-a)))
(defn set-a!
"Property.
A float representing the a component of the matrix."
[this val]
(aset this "a" val))
(defn b
"Property.
A float representing the b component of the matrix."
[this]
(-> this (.-b)))
(defn set-b!
"Property.
A float representing the b component of the matrix."
[this val]
(aset this "b" val))
(defn c
"Property.
A float representing the c component of the matrix."
[this]
(-> this (.-c)))
(defn set-c!
"Property.
A float representing the c component of the matrix."
[this val]
(aset this "c" val))
(defn d
"Property.
A float representing the d component of the matrix."
[this]
(-> this (.-d)))
(defn set-d!
"Property.
A float representing the d component of the matrix."
[this val]
(aset this "d" val))
(defn e
"Property.
A float representing the e component of the matrix."
[this]
(-> this (.-e)))
(defn set-e!
"Property.
A float representing the e component of the matrix."
[this val]
(aset this "e" val))
(defn f
"Property.
A float representing the f component of the matrix."
[this]
(-> this (.-f)))
(defn set-f!
"Property.
A float representing the f component of the matrix."
[this val]
(aset this "f" val))