-
Notifications
You must be signed in to change notification settings - Fork 0
/
ec-css-hover.css
661 lines (574 loc) · 14.2 KB
/
ec-css-hover.css
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
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
/*
* 简单鼠标动作 this effect base 当前元素 简单变化 设置鼠标动作 利用过渡实现
*/
.ech-border, .ech-shadow, .ech-border-in, .ech-shadow-in,.ech-shadow-write, .ech-radius, .ech-rectangle, .ech-fade-out, .ech-fade-in, .ech-t, .ech-b, .ech-l, .ech-r, .ech-grow-rotate-l,.ech-grow-rotate-r, .ech-rotate5, .ech-rotate15, .ech-rotate30, .ech-rotate60, .ech-rotate90, .ech-rotate180, .ech-rotate360, .ech-skew-l, .ech-skew-r, .ech-skew-l-t, .ech-skew-r-b, .ech-skew-l-b, .ech-skew-r-t, .ech-rotate-5,.ech-rotate-15, .ech-rotate-30, .ech-rotate-60, .ech-rotate-90, .ech-rotate-180, .ech-shadow-big, .ech-big, .ech-small {
transition: all .4s;
}
/* 鼠标效果 简单动画(hover effect) */
.ech-rectangle:hover {
border-radius: 10px;
}
.ech-radius {
border-radius: 10px;
}
.ech-radius:hover {
border-radius: 0;
}
/*边框*/
.ech-border:hover {
box-shadow: 0 0 0 4px #09f, 0 0 1px transparent;
}
.ech-border-in:hover {
box-shadow: inset 0 0 0 4px #09f, 0 0 1px transparent;
}
/*大小变化*/
.ech-big:hover{
transform: scale(1.2);
}
.ech-small:hover{
transform: scale(.9);
}
/*阴影变化*/
.ech-shadow:hover {
box-shadow: 0 0 10px #333;
}
.ech-shadow-in:hover {
box-shadow: inset 0 0 10px #333;
}
.ech-shadow-white:hover {
box-shadow: inset 0 0 20px #fff;
}
.ech-shadow-big:hover {
box-shadow: 0 10px 10px -10px rgba(0, 0, 0, 0.5);
transform: scale(1.1);
}
/*透明度变化*/
.ech-fade-out:hover {
opacity: .6;
}
/*位移*/
.ech-t:hover {
transform: translate3d(0, -10px, 0);
}
.ech-b:hover {
transform: translate3d(0, 10px, 0);
}
.ech-l:hover {
transform: translate3d(-10px, 0, 0);
}
.ech-r:hover {
transform: translate3d(10px, 0, 0);
}
/*旋转*/
.ech-rotate5:hover {
transform: rotate(5deg);
}
.ech-rotate15:hover {
transform: rotate(15deg);
}
.ech-rotate30:hover {
transform: rotate(30deg);
}
.ech-rotate60:hover {
transform: rotate(60deg);
}
.ech-rotate90:hover {
transform: rotate(90deg);
}
.ech-rotate180:hover {
transform: rotate(180deg);
}
.ech-rotate360:hover {
transform: rotate(360deg);
}
.ech-grow-rotate-l:hover {
transform: scale(1.1) rotate(4deg);
}
.ech-grow-rotate-r:hover {
transform: scale(1.1) rotate(-4deg);
}
.ech-rotate-5:hover {
transform: rotate(-5deg);
}
.ech-rotate-15:hover {
transform: rotate(-15deg);
}
.ech-rotate-30:hover {
transform: rotate(-30deg);
}
.ech-rotate-60:hover {
transform: rotate(-60deg);
}
.ech-rotate-90:hover {
transform: rotate(-90deg);
}
.ech-rotate-180:hover {
transform: rotate(-180deg);
}
/*形状变化*/
.ech-skew-l:hover {
transform: skew(-15deg);
}
.ech-skew-r:hover {
transform: skew(15deg);
}
.ech-skew-l-t:hover {
transform: skew(-15deg);
}
.ech-skew-r-t:hover {
transform: skew(15deg);
}
.ech-skew-l-b:hover {
transform: skew(15deg);
}
.ech-skew-r-b:hover {
transform: skew(-15deg);
}
.ech-skew-r-t, .ech-skew-l-t {
transform-origin: 0 100%;
}
.ech-skew-r-b, .ech-skew-l-b {
transform-origin: 100% 0;
}
/*当前元素 作用于 after before*/
.ech-fade, .ech-fade-t, .ech-fade-b, .ech-fade-l, .ech-fade-r, .ech-fade-c-in, .ech-fade-m-in, .ech-fade-m-out, .ech-fade-c-out, .ech-overline-r, .ech-overline-l, .ech-underline-r, .ech-underline-l, .ech-underline-c, .ech-overline-c, .ech-underline-c-out, .ech-overline-c-out, .ech-arrow-l, .ech-arrow-r, .ech-arrow-t, .ech-arrow-b, .ech-arrow-l-move, .ech-arrow-r-move, .ech-arrow-t-move, .ech-arrow-b-move, .ech-bounce-t, .ech-bounce-b, .ech-bounce-r, .ech-bounce-l {
position: relative;
transition: all .3s;
z-index: 1;
}
.ech-fade:before, .ech-fade-t:before, .ech-fade-b:before, .ech-fade-l:before, .ech-fade-r:before, .ech-fade-c-in:before, .ech-fade-m-in:before, .ech-fade-m-out:before, .ech-fade-c-in:after, .ech-fade-m-in:after, .ech-fade-c-out:before {
transition: all .3s;
position: absolute;
content: "";
display: block;
background: #09f;
z-index: -1;
width: 100%;
height: 100%;
}
/*背景颜色和文字变化*/
.ech-fade:before {
top: 0;
left: 0;
transform: scaleX(1);
opacity: 0;
}
.ech-fade:hover:before {
opacity: 1;
}
/*颜色上下变化*/
.ech-fade-t:before, .ech-bounce-t:before {
bottom: 0;
left: 0;
transform-origin: 50% 0;
transform: scaleY(0);
}
.ech-fade-b:before, .ech-bounce-b:before {
top: 0;
left: 0;
transform-origin: 50% 100%;
transform: scaleY(0);
}
.ech-fade-t:hover:before, .ech-fade-b:hover:before, .ech-fade-m-out:hover:before, .ech-bounce-b:hover:before, .ech-bounce-t:hover:before {
transform: scaleY(1);
}
.ech-fade:hover, .ech-fade-t:hover, .ech-fade-b:hover, .ech-fade-l:hover, .ech-fade-r:hover, .ech-fade-c-in:hover, .ech-fade-m-in:hover, .ech-fade-m-out:hover, .ech-fade-c-out:hover, .ech-bounce-t:hover, .ech-bounce-b:hover, .ech-bounce-r:hover, .ech-bounce-l:hover {
color: #fff;
}
/*颜色左右变化*/
.ech-fade-l:before, .ech-bounce-l:before {
top: 0;
right: 0;
transform-origin: 0 50%;
transform: scaleX(0);
}
.ech-fade-r:before, .ech-bounce-r:before {
top: 0;
left: 0;
transform-origin: 100% 50%;
transform: scaleX(0);
}
.ech-fade-c-in:hover:before, .ech-fade-c-in:hover:after, .ech-overline-c:hover:after, .ech-overline-c:hover:before, .ech-underline-c:hover:after, .ech-underline-c:hover:before {
transform: scaleX(.51);
}
.ech-fade-l:hover:before, .ech-fade-r:hover:before,.ech-fade-c-out:hover:before, .ech-bounce-l:hover:before, .ech-bounce-r:hover:before, .ech-overline-l:hover:before, .ech-overline-r:hover:before, .ech-underline-l:hover:before, .ech-underline-r:hover:before, .ech-underline-c-out:hover:before, .ech-overline-c-out:hover:before {
transform: scaleX(1);
}
.ech-bounce-t:before, .ech-bounce-b:before, .ech-bounce-r:before, .ech-bounce-l:before {
transition: all .3s;
transition-timing-function: cubic-bezier(0.52, 1.7, 0.5, 0.4);
position: absolute;
content: "";
display: block;
background: #09f;
z-index: -1;
width: 100%;
height: 100%;
}
/*水平居中出去*/
.ech-fade-c-out:before {
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
transform: scaleX(0);
}
/*水平居中进来*/
.ech-fade-c-in:before {
top: 0;
left: 0;
transform-origin: 0 50%;
transform: scaleX(0);
}
.ech-fade-c-in:after {
top: 0;
right: 0;
transform-origin: 100% 50%;
transform: scaleX(0);
}
/*垂直居中出去*/
.ech-fade-m-out:before {
top: 0;
bottom: 0;
left: 0;
margin: auto;
transform: scaleY(0);
}
/*垂直居中进来*/
.ech-fade-m-in:before {
top: 0;
left: 0;
transform-origin: 50% 0;
transform: scaleY(0);
}
.ech-fade-m-in:after {
bottom: 0;
left: 0;
transform-origin: 50% 100%;
transform: scaleY(0);
}
.ech-fade-m-in:hover:before, .ech-fade-m-in:hover:after {
transform: scaleY(.51);
}
.ech-fade-c-in:hover:before, .ech-fade-c-in:hover:after, .ech-overline-c:hover:after, .ech-overline-c:hover:before, .ech-underline-c:hover:after, .ech-underline-c:hover:before {
transform: scaleX(.51);
}
.ech-fade-l:hover:before, .ech-fade-r:hover:before,.ech-fade-c-out:hover:before, .ech-bounce-l:hover:before, .ech-bounce-r:hover:before, .ech-overline-l:hover:before, .ech-overline-r:hover:before, .ech-underline-l:hover:before, .ech-underline-r:hover:before, .ech-underline-c-out:hover:before, .ech-overline-c-out:hover:before {
transform: scaleX(1);
}
/*上划线和下划线变化*/
/*初始化:after:before大小*/
.ech-overline-r:before, .ech-overline-l:before, .ech-underline-l:before, .ech-underline-r:before, .ech-underline-c:before, .ech-overline-c:before, .ech-underline-c:after, .ech-overline-c:after, .ech-underline-c-out:before, .ech-overline-c-out:before {
position: absolute;
transition: all .3s;
content: "";
display: block;
background: #09f;
z-index: -1;
height: 4px;
width: 100%;
transform: scaleX(0);
}
/*上划线 左右出来*/
.ech-overline-r:before {
top: 0;
left: 0;
transform-origin: 100% 50%;
}
.ech-overline-l:before {
top: 0;
right: 0;
transform-origin: 0 50%;
}
/*下划线 左右出来*/
.ech-underline-r:before {
bottom: 0;
left: 0;
transform-origin: 100% 50%;
}
.ech-underline-l:before {
bottom: 0;
right: 0;
transform-origin: 0% 50%;
}
/**上划线 下划线 居中进来**/
.ech-overline-c:before {
top: 0;
transform-origin: 0 50%;
}
.ech-overline-c:after {
top: 0;
transform-origin: 100% 50%;
}
.ech-underline-c:before {
bottom: 0;
transform-origin: 0 50%;
}
.ech-underline-c:after {
bottom: 0;
transform-origin: 100% 50%;
}
.ech-overline-c:before, .ech-underline-c:before {
left: 0;
}
.ech-overline-c:after, .ech-underline-c:after {
right: 0;
}
/*上划线 下划线-居中出去 */
.ech-overline-c-out:before {
top: 0;
left: 0;
right: 0;
margin: auto;
}
.ech-underline-c-out:before {
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
/*仿闹钟振铃效果*/
.ech-shake-time:hover {
animation: shake-time 1s ease;
}
@keyframes shake-time {
0% {
transform: scale(1);
}
10%, 20% {
transform: scale(0.9) rotate(-3deg);
}
30%, 50%, 70%, 90% {
transform: scale(1.1) rotate(3deg);
}
40%, 60%, 80% {
transform: scale(1.1) rotate(-3deg);
}
100% {
transform: scale(1) rotate(0);
}
}
/*弹跳变化*/
.ech-bounce:hover {
animation: bounce 1s ease;
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-30px);
}
60% {
transform: translateY(-15px);
}
}
/*摇晃*/
.ech-wobble:hover {
animation: wobble 1s ease;
}
@keyframes wobble {
0% {
transform: translateX(0);
}
15% {
transform: translateX(-100px) rotate(-5deg);
}
30% {
transform: translateX(80px) rotate(3deg);
}
45% {
transform: translateX(-65px) rotate(-3deg);
}
60% {
transform: translateX(40px) rotate(2deg);
}
75% {
transform: translateX(-20px) rotate(-1deg);
}
100% {
transform: translateX(0);
}
}
/*摇摆*/
.ech-swing:hover {
animation: swing .5s ease alternate;
}
@keyframes swing {
20% {
transform: rotate(15deg);
}
40% {
transform: rotate(-10deg);
}
60% {
transform: rotate(5deg);
}
80% {
transform: rotate(-5deg);
}
100% {
transform: rotate(0);
}
}
/*闪烁变化*/
.ech-flash:hover {
animation: flash .5s ease;
}
@keyframes flash {
0%, 50%, 100% {
opacity: 1;
}
25%, 75% {
opacity: 0;
}
}
/*震动*/
.ech-shake:hover {
animation: shake .5s ease;
}
@keyframes shake {
0%, 100% {
transform: translateX(0);
}
10%, 30%, 50%, 70%, 90% {
transform: translateX(-10px);
}
20%, 40%, 60%, 80% {
transform: translateX(10px);
}
}
/*
* 当前元素 较复杂动画,利用动画实现
*/
.ech-wobble-t, .ech-skew-r-t, .ech-skew-l-t {
transform-origin: 0 100%;
}
.ech-wobble-b, .ech-skew-r-b, .ech-skew-l-b {
transform-origin: 100% 0;
}
.ech-wobble-c:hover, .ech-wobble-t:hover,.ech-wobble-b:hover {
animation: wobble-x 1s ease-in-out;
}
@keyframes wobble-x {
16.65% {
-webkit-transform: skew(-12deg);
transform: skew(-12deg);
}
33.3% {
-webkit-transform: skew(10deg);
transform: skew(10deg);
}
49.95% {
-webkit-transform: skew(-6deg);
transform: skew(-6deg);
}
66.6% {
-webkit-transform: skew(4deg);
transform: skew(4deg);
}
83.25% {
-webkit-transform: skew(-2deg);
transform: skew(-2deg);
}
100% {
-webkit-transform: skew(0);
transform: skew(0);
}
}
/*箭头效果*/
.ech-arrow-l:before, .ech-arrow-r:before, .ech-arrow-t:before, .ech-arrow-b:before, .ech-arrow-l-move:before, .ech-arrow-r-move:before, .ech-arrow-t-move:before, .ech-arrow-b-move:before {
position: absolute;
transition: all .3s;
content: "";
display: block;
z-index: -1;
border-style: solid;
margin: auto;
width: 0;
height: 0;
}
.ech-arrow-l:before, .ech-arrow-l-move:before {
left: 0;
top: 0;
bottom: 0;
border-width: 10px 10px 10px 0;
border-color: transparent #ccc transparent transparent;
}
.ech-arrow-r:before, .ech-arrow-r-move:before {
right: 0;
top: 0;
bottom: 0;
border-width: 10px 0 10px 10px;
border-color: transparent transparent transparent #ccc;
}
.ech-arrow-t:before, .ech-arrow-t-move:before {
left: 0;
top: 0;
right: 0;
border-width: 0 10px 10px 10px;
border-color: transparent transparent #ccc transparent;
}
.ech-arrow-b:before, .ech-arrow-b-move:before {
left: 0;
bottom: 0;
right: 0;
border-width: 10px 10px 0 10px;
border-color: #ccc transparent transparent transparent;
}
.ech-arrow-l-move, .ech-arrow-r-move, .ech-arrow-t-move, .ech-arrow-b-move {
transition: transform .3s;
}
.ech-arrow-l-move:hover {
transform: translateX(10px);
}
.ech-arrow-r-move:hover {
transform: translateX(-10px);
}
.ech-arrow-t-move:hover {
transform: translateY(10px);
}
.ech-arrow-b-move:hover {
transform: translateY(-10px);
}
.ech-arrow-l-move:hover:before, .ech-arrow-l:hover:before {
transform: translateX(-10px);
}
.ech-arrow-r-move:hover:before, .ech-arrow-r:hover:before {
transform: translateX(10px);
}
.ech-arrow-t-move:hover:before, .ech-arrow-t:hover:before {
transform: translateY(-10px);
}
.ech-arrow-b-move:hover:before, .ech-arrow-b:hover:before {
transform: translateY(10px);
}
/*大小变化*/
.ech-pulse:hover{
animation: pulse 1s infinite alternate linear;
}
/*心跳效果*/
@keyframes pulse {
25% {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
75% {
-webkit-transform: scale(0.9);
transform: scale(0.9);
}
}
.ech-pulse-shrink:hover{
animation: pulse-shrink .5s infinite alternate linear;
}
@keyframes pulse-shrink {
to {
-webkit-transform: scale(0.9);
transform: scale(0.9);
}
}
/*无限次数执行动画*/
.ech-infinite:hover {
animation-iteration-count: infinite;
}