forked from elrumordelaluz/csshake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_shake.scss
83 lines (71 loc) · 3.13 KB
/
_shake.scss
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
// reset
$duration:100ms;
$base-name:shake-base;
$iteration:infinite;
$timing:ease-in-out;
$delay:0s;
$state:running;
// The animation
@mixin animation($name, $dur: $duration, $iter: $iteration, $tim: $timing, $del: $delay, $sta: $state){
@include vendorize(animation-name, $name, webkit ms spec);
@include vendorize(animation-duration, $dur, webkit ms spec);
@include vendorize(animation-iteration-count, $iter, webkit ms spec);
@include vendorize(animation-timing-function, $tim, webkit ms spec);
@include vendorize(animation-delay, $del, webkit ms spec);
@include vendorize(animation-play-state, $sta, webkit ms spec);
}
.shake {
display: inline-block;
@include vendorize(transform-origin, center center, webkit ms spec);
&:hover {
@include animation($base-name);
}
&.freez {
&.shake-hard { @include animation(shake-hard); }
&.shake-slow { @include animation(shake-slow, 5s); }
&.shake-little { @include animation(shake-little); }
&.shake-horizontal { @include animation(shake-horizontal); }
&.shake-vertical { @include animation(shake-vertical); }
&.shake-rotate { @include animation(shake-rotate); }
&.shake-opacity { @include animation(shake-opacity, 200ms); }
&.shake-crazy { @include animation(shake-crazy); }
@include vendorize(animation-play-state, paused!important, webkit ms spec);
&:hover {
@include vendorize(animation-play-state, running!important, webkit ms spec);
}
}
// Specific shakings
&.shake-hard:hover { @include animation(shake-hard); }
&.shake-slow:hover { @include animation(shake-slow, 5s); }
&.shake-little:hover { @include animation(shake-little); }
&.shake-horizontal:hover { @include animation(shake-horizontal); }
&.shake-vertical:hover { @include animation(shake-vertical); }
&.shake-rotate:hover { @include animation(shake-rotate); }
&.shake-opacity:hover { @include animation(shake-opacity, 200ms); }
&.shake-crazy:hover { @include animation(shake-crazy); }
&.shake-constant {
@include animation($base-name);
&.shake-hard { @include animation(shake-hard); }
&.shake-slow { @include animation(shake-slow, 5s); }
&.shake-little { @include animation(shake-little); }
&.shake-horizontal { @include animation(shake-horizontal); }
&.shake-vertical { @include animation(shake-vertical); }
&.shake-rotate { @include animation(shake-rotate); }
&.shake-opacity { @include animation(shake-opacity, 200ms); }
&.shake-crazy { @include animation(shake-crazy); }
&.hover-stop:hover{
@include vendorize(animation-play-state, paused, webkit ms spec);
}
}
&.shake-delay { @include animation($base-name, $duration, $iteration, $timing, 4s); }
}
// The animations: its names and settings to call from animation mixin
@include shake(5px, 5px, 3deg, 'shake-base', 2);
@include shake(2px, 2px, 1deg, 'shake-little', 2);
@include shake(20px, 20px, 7deg, 'shake-slow', 2);
@include shake(20px, 20px, 7deg, 'shake-hard', 2);
@include shake(20px, 0px, 0deg, 'shake-horizontal', 2);
@include shake(0px, 20px, 0deg, 'shake-vertical', 2);
@include shake(0px, 0px, 15deg, 'shake-rotate', 2);
@include shake(10px, 10px, 5deg, 'shake-opacity', 10, true);
@include shake(40px, 40px, 20deg, 'shake-crazy', 10, true);