@@ -12,7 +12,7 @@ type Values = {
12
12
} ;
13
13
14
14
const attribute = 'animation' ;
15
- let getCodeButtonElement = utils . getCopyCodeButton ( attribute ) ;
15
+ const getCodeButtonElement = utils . getCopyCodeButton ( attribute ) ;
16
16
17
17
const OutputElement = utils . getOutput ( attribute ) ;
18
18
const DegreeElement = utils . getRange ( attribute ) ;
@@ -137,6 +137,27 @@ function manageAnimation(
137
137
OutputElement . style . animation = `turnaround ease-in` ;
138
138
OutputElement . style . animationDuration = `${ values . duration } s` ;
139
139
140
+ // rule_added = true;
141
+ } else if ( values . type === 'rotate' ) {
142
+ css =
143
+ `/*Copy and paste keyframe into your css file, and apply the animation property in the element of your choice*/\n` +
144
+ `@keyframes rotate { \n` +
145
+ `0% { transform:rotate(0deg); }\n` +
146
+ `100% { transform:rotate(${ values . degree } deg); }\n` +
147
+ `}\n` +
148
+ `animate: rotate ${ values . duration } s infinite` ;
149
+
150
+ stylesheet . insertRule (
151
+ `@keyframes rotate { \n` +
152
+ `0% { transform:rotate(0deg); }\n` +
153
+ `100% { transform:rotate(${ values . degree } deg); }\n` +
154
+ `}` ,
155
+ initial_length + 1
156
+ ) ;
157
+
158
+ OutputElement . style . animation = `rotate ease-in` ;
159
+ OutputElement . style . animationDuration = `${ values . duration } s` ;
160
+
140
161
// rule_added = true;
141
162
}
142
163
}
@@ -180,6 +201,13 @@ function initialConfiguration(
180
201
DegreeElement . value = '50' ;
181
202
unitDisplayElement . innerText = `${ DegreeElement . value } deg` ;
182
203
titleDisplayElement . innerText = 'Angle' ;
204
+ } else if ( type === 'rotate' ) {
205
+ DegreeElement . min = '0' ;
206
+ DegreeElement . max = '360' ;
207
+ DegreeElement . step = '1' ;
208
+ DegreeElement . value = '45' ;
209
+ unitDisplayElement . innerText = `${ DegreeElement . value } deg` ;
210
+ titleDisplayElement . innerText = 'Degrees' ;
183
211
} else {
184
212
DegreeElement . min = '0' ;
185
213
DegreeElement . max = '1' ;
0 commit comments