Blame view

bower_components/paper-spinner/paper-spinner.css 9.99 KB
c5169e0e   Renato De Donato   a new hope
1
  /**
73bcce88   luigser   COMPONENTS
2
3
4
5
6
7
8
  @license
  Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
  This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
  The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
  The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
  Code distributed by Google as part of the polymer project is also
  subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
c5169e0e   Renato De Donato   a new hope
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
  
  */
  /**************************/
  /* STYLES FOR THE SPINNER */
  /**************************/
  
  /*
   * Constants:
   *      STROKEWIDTH = 3px
   *      ARCSIZE     = 270 degrees (amount of circle the arc takes up)
   *      ARCTIME     = 1333ms (time it takes to expand and contract arc)
   *      ARCSTARTROT = 216 degrees (how much the start location of the arc
   *                                should rotate each time, 216 gives us a
   *                                5 pointed star shape (it's 360/5 * 3).
   *                                For a 7 pointed star, we might do
   *                                360/7 * 3 = 154.286)
   *      CONTAINERWIDTH = 28px
   *      SHRINK_TIME = 400ms
   */
  
  :host {
    display: inline-block;
    position: relative;
    width: 28px; /* CONTAINERWIDTH */
    height: 28px; /* CONTAINERWIDTH */
  }
  
  #spinnerContainer {
    width: 100%;
    height: 100%;
  
    /* The spinner does not have any contents that would have to be
     * flipped if the direction changes. Always use ltr so that the
     * style works out correctly in both cases. */
    direction: ltr;
  }
  
  #spinnerContainer.active {
    /* duration: 360 * ARCTIME / (ARCSTARTROT + (360-ARCSIZE)) */
    -webkit-animation: container-rotate 1568ms linear infinite;
    animation: container-rotate 1568ms linear infinite;
  }
  
  @-webkit-keyframes container-rotate {
    to { -webkit-transform: rotate(360deg) }
  }
  
  @keyframes container-rotate {
    to { transform: rotate(360deg) }
  }
  
  .spinner-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
  }
  
  .layer-1 {
    border-color: var(--paper-spinner-layer-1-color, --google-blue-500);
  }
  
  .layer-2 {
    border-color: var(--paper-spinner-layer-2-color, --google-red-500);
  }
  
  .layer-3 {
    border-color: var(--paper-spinner-layer-3-color, --google-yellow-500);
  }
  
  .layer-4 {
    border-color: var(--paper-spinner-layer-4-color, --google-blue-500);
  }
  
  /**
   * IMPORTANT NOTE ABOUT CSS ANIMATION PROPERTIES (keanulee):
   *
   * iOS Safari (tested on iOS 8.1) does not handle animation-delay very well - it doesn't
   * guarantee that the animation will start _exactly_ after that value. So we avoid using
   * animation-delay and instead set custom keyframes for each color (as layer-2undant as it
   * seems).
   *
   * We write out each animation in full (instead of separating animation-name,
   * animation-duration, etc.) because under the polyfill, Safari does not recognize those
   * specific properties properly, treats them as -webkit-animation, and overrides the
   * other animation rules. See https://github.com/Polymer/platform/issues/53.
   */
  .active .spinner-layer.layer-1 {
    /* durations: 4 * ARCTIME */
    -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-1-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
    animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-1-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
  }
  
  .active .spinner-layer.layer-2 {
    /* durations: 4 * ARCTIME */
    -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-2-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
    animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-2-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
  }
  
  .active .spinner-layer.layer-3 {
    /* durations: 4 * ARCTIME */
    -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-3-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
    animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-3-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
  }
  
  .active .spinner-layer.layer-4 {
    /* durations: 4 * ARCTIME */
    -webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-4-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
    animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-4-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
  }
  
  @-webkit-keyframes fill-unfill-rotate {
    12.5% { -webkit-transform: rotate(135deg);  } /* 0.5 * ARCSIZE */
    25%   { -webkit-transform: rotate(270deg);  } /* 1   * ARCSIZE */
    37.5% { -webkit-transform: rotate(405deg);  } /* 1.5 * ARCSIZE */
    50%   { -webkit-transform: rotate(540deg);  } /* 2   * ARCSIZE */
    62.5% { -webkit-transform: rotate(675deg);  } /* 2.5 * ARCSIZE */
    75%   { -webkit-transform: rotate(810deg);  } /* 3   * ARCSIZE */
    87.5% { -webkit-transform: rotate(945deg);  } /* 3.5 * ARCSIZE */
    to    { -webkit-transform: rotate(1080deg); } /* 4   * ARCSIZE */
  }
  
  @keyframes fill-unfill-rotate {
    12.5% { transform: rotate(135deg);  } /* 0.5 * ARCSIZE */
    25%   { transform: rotate(270deg);  } /* 1   * ARCSIZE */
    37.5% { transform: rotate(405deg);  } /* 1.5 * ARCSIZE */
    50%   { transform: rotate(540deg);  } /* 2   * ARCSIZE */
    62.5% { transform: rotate(675deg);  } /* 2.5 * ARCSIZE */
    75%   { transform: rotate(810deg);  } /* 3   * ARCSIZE */
    87.5% { transform: rotate(945deg);  } /* 3.5 * ARCSIZE */
    to    { transform: rotate(1080deg); } /* 4   * ARCSIZE */
  }
  
  /**
   * HACK: Even though the intention is to have the current .spinner-layer at
   * `opacity: 1`, we set it to `opacity: 0.99` instead since this forces Chrome
   * to do proper subpixel rendering for the elements being animated. This is
   * especially visible in Chrome 39 on Ubuntu 14.04. See:
   *
   * - https://github.com/Polymer/paper-spinner/issues/9
   * - https://code.google.com/p/chromium/issues/detail?id=436255
   */
  @-webkit-keyframes layer-1-fade-in-out {
    from { opacity: 0.99; }
    25% { opacity: 0.99; }
    26% { opacity: 0; }
    89% { opacity: 0; }
    90% { opacity: 0.99; }
    100% { opacity: 0.99; }
  }
  
  @keyframes layer-1-fade-in-out {
    from { opacity: 0.99; }
    25% { opacity: 0.99; }
    26% { opacity: 0; }
    89% { opacity: 0; }
    90% { opacity: 0.99; }
    100% { opacity: 0.99; }
  }
  
  @-webkit-keyframes layer-2-fade-in-out {
    from { opacity: 0; }
    15% { opacity: 0; }
    25% { opacity: 0.99; }
    50% { opacity: 0.99; }
    51% { opacity: 0; }
  }
  
  @keyframes layer-2-fade-in-out {
    from { opacity: 0; }
    15% { opacity: 0; }
    25% { opacity: 0.99; }
    50% { opacity: 0.99; }
    51% { opacity: 0; }
  }
  
  @-webkit-keyframes layer-3-fade-in-out {
    from { opacity: 0; }
    40% { opacity: 0; }
    50% { opacity: 0.99; }
    75% { opacity: 0.99; }
    76% { opacity: 0; }
  }
  
  @keyframes layer-3-fade-in-out {
    from { opacity: 0; }
    40% { opacity: 0; }
    50% { opacity: 0.99; }
    75% { opacity: 0.99; }
    76% { opacity: 0; }
  }
  
  @-webkit-keyframes layer-4-fade-in-out {
    from { opacity: 0; }
    65% { opacity: 0; }
    75% { opacity: 0.99; }
    90% { opacity: 0.99; }
    100% { opacity: 0; }
  }
  
  @keyframes layer-4-fade-in-out {
    from { opacity: 0; }
    65% { opacity: 0; }
    75% { opacity: 0.99; }
    90% { opacity: 0.99; }
    100% { opacity: 0; }
  }
  
  /**
   * Patch the gap that appear between the two adjacent div.circle-clipper while the
   * spinner is rotating (appears on Chrome 38, Safari 7.1, and IE 11).
   *
   * Update: the gap no longer appears on Chrome when .spinner-layer's opacity is 0.99,
   * but still does on Safari and IE.
   */
  .gap-patch {
    position: absolute;
    box-sizing: border-box;
    top: 0;
    left: 45%;
    width: 10%;
    height: 100%;
    overflow: hidden;
    border-color: inherit;
  }
  
  .gap-patch .circle {
    width: 1000%;
    left: -450%;
  }
  
  .circle-clipper {
    display: inline-block;
    position: relative;
    width: 50%;
    height: 100%;
    overflow: hidden;
    border-color: inherit;
  }
  
  .circle-clipper .circle {
    width: 200%;
  }
  
  .circle {
    box-sizing: border-box;
    height: 100%;
    border-width: 3px; /* STROKEWIDTH */
    border-style: solid;
    border-color: inherit;
    border-bottom-color: transparent !important;
    border-radius: 50%;
    -webkit-animation: none;
    animation: none;
  
    @apply(--layout-fit);
  }
  
  .circle-clipper.left .circle {
    border-right-color: transparent !important;
    -webkit-transform: rotate(129deg);
    transform: rotate(129deg);
  }
  
  .circle-clipper.right .circle {
    left: -100%;
    border-left-color: transparent !important;
    -webkit-transform: rotate(-129deg);
    transform: rotate(-129deg);
  }
  
  .active .circle-clipper.left .circle {
    /* duration: ARCTIME */
    -webkit-animation: left-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
    animation: left-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
  }
  
  .active .circle-clipper.right .circle {
    /* duration: ARCTIME */
    -webkit-animation: right-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
    animation: right-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
  }
  
  @-webkit-keyframes left-spin {
    from { -webkit-transform: rotate(130deg); }
    50% { -webkit-transform: rotate(-5deg); }
    to { -webkit-transform: rotate(130deg); }
  }
  
  @keyframes left-spin {
    from { transform: rotate(130deg); }
    50% { transform: rotate(-5deg); }
    to { transform: rotate(130deg); }
  }
  
  @-webkit-keyframes right-spin {
    from { -webkit-transform: rotate(-130deg); }
    50% { -webkit-transform: rotate(5deg); }
    to { -webkit-transform: rotate(-130deg); }
  }
  
  @keyframes right-spin {
    from { transform: rotate(-130deg); }
    50% { transform: rotate(5deg); }
    to { transform: rotate(-130deg); }
  }
  
  #spinnerContainer.cooldown {
    /* duration: SHRINK_TIME */
    -webkit-animation: container-rotate 1568ms linear infinite, fade-out 400ms cubic-bezier(0.4, 0.0, 0.2, 1);
    animation: container-rotate 1568ms linear infinite, fade-out 400ms cubic-bezier(0.4, 0.0, 0.2, 1);
  }
  
  @-webkit-keyframes fade-out {
    from { opacity: 0.99; }
    to { opacity: 0; }
  }
  
  @keyframes fade-out {
    from { opacity: 0.99; }
    to { opacity: 0; }
  }