-
Notifications
You must be signed in to change notification settings - Fork 4
/
_mixins.scss
163 lines (140 loc) · 6.43 KB
/
_mixins.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
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
/* VENDOR PREFIXES
* ============================================= */
@mixin prefix($property, $value) {
-webkit-#{$property}: $value; /* Safari and Chrome */
-khtml-#{$property}: $value; /* IE 9 */
-ms-#{$property}: $value; /* IE 9 */
-moz-#{$property}: $value; /* Firefox */
-o-#{$property}: $value; /* Opera */
#{$property}: $value;
}
/* OPACITY
* ============================================= */
@mixin opacity($trans: 0.75) {
@include prefix(opacity, $trans);
filter: alpha(opacity = $trans * 100);
}
/* ROTATE
* ============================================= */
@mixin rotate($degree: 7deg) {
@include prefix(rotate, $degree);
}
/* BORDER BOX - http://www.paulirish.com/2012/box-sizing-border-box-ftw/
* ============================================= */
@mixin border-box() {
@include prefix(border-sizing, border-box);
}
/* ROUND BORDERS
* ============================================= */
@mixin border-radius($radius: 4px) {
@include prefix(border-radius, $radius);
}
////////////////////////////////////////////////////////////
// UNFINISHED MIXINS //////////////////////////////////////
//////////////////////////////////////////////////////////
/* SHADOW MIXINS - up to 6 shadow declarations for each style
* ============================================= */
@mixin box-shadow($offset: 1px, $spread: 2px, $color: #999999) {
-webkit-box-shadow: 0px $offset $spread $color;
-khtml-box-shadow: 0px $offset $spread $color;
-moz-box-shadow: 0px $offset $spread $color;
-ms-box-shadow: 0px $offset $spread $color;
-o-box-shadow: 0px $offset $spread $color;
box-shadow: 0px $offset $spread $color;
}
@mixin no-box-shadow {
-webkit-appearance: none;
-webkit-box-shadow: none;
-khtml-box-shadow: none;
-moz-box-shadow: none;
-ms-box-shadow: none;
-o-box-shadow: none;
box-shadow: none;
}
/* GRADIENTS
* ============================================= */
@mixin linear-gradient($start: white, $end: #cccccc) {
background-color: $start;
//background-image: url(images/fallback-gradient.png);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($start), to($end));
background-image: -webkit-linear-gradient(top, $start, $end);
background-image: -moz-linear-gradient(top, $start, $end);
background-image: -ms-linear-gradient(top, $start, $end);
background-image: -o-linear-gradient(top, $start, $end);
background-image: linear-gradient(top, $start, $end);
}
@mixin radial-gradient($r1: 0, $r2: 200, $start: white, $end: #cccccc, $m1: 0%, $m2: 100%) {
background: $end;
background: -moz-radial-gradient(center 45deg, circle closest-side, $start $m1, $end $m2);
background: -webkit-gradient(radial, center center, $r1, center center, $r2, from($start), to($end));
}
@mixin inner_shadow($x: 1px, $y: 1px, $z: 3px, $color: black) {
box-shadow: inset $x $y $z $color;
-moz-box-shadow: inset $x $y $z $color;
-webkit-box-shadow: inset $x $y $z $color;
-o-box-shadow: inset $x $y $z $color;
-ms-box-shadow: inset $x $y $z $color;
}
@mixin double_inner_shadow($x: 0px, $y: 1px, $z: 0px, $color: rgba(255, 255, 255, 0.25), $x2: 0px, $y2: 1px, $z2: 0px, $color2: rgba(255, 255, 255, 0.5)) {
box-shadow: $x $y $z $color inset, $x2 $y2 $z2 $color2 inset;
-moz-box-shadow: $x $y $z $color inset, $x2 $y2 $z2 $color2 inset;
-webkit-box-shadow: $x $y $z $color inset, $x2 $y2 $z2 $color2 inset;
-o-box-shadow: $x $y $z $color inset, $x2 $y2 $z2 $color2 inset;
-ms-box-shadow: $x $y $z $color inset, $x2 $y2 $z2 $color2 inset;
}
@mixin super_shadow($x: 0px, $y: 1px, $z: 0px, $color: rgba(255, 255, 255, 0.25), $x2: 0px, $y2: 1px, $z2: 0px, $color2: rgba(255, 255, 255, 0.5)) {
box-shadow: inset $x $y $z $color, $x2 $y2 $z2 $color2;
-moz-box-shadow: inset $x $y $z $color, $x2 $y2 $z2 $color2;
-webkit-box-shadow: inset $x $y $z $color, $x2 $y2 $z2 $color2;
-o-box-shadow: inset $x $y $z $color, $x2 $y2 $z2 $color2;
-ms-box-shadow: inset $x $y $z $color, $x2 $y2 $z2 $color2;
}
/* TRANSITIONS
* ============================================= */
/* ease, ease-in, ease-out, ease-in-out, linear, */
/* cubic-bezier(1.0, 0, 0, 1.0) */
@mixin transition($target: all, $duration: 0.5s, $transition: ease-in-out) {
transition: $target $duration $transition;
-o-transition: $target $duration $transition;
-moz-transition: $target $duration $transition;
-webkit-transition: $target $duration $transition; }
/* translate(x, y) moves the position of an item */
/* scale(w, h) changes the size (scale) 1-0 scale */
/* rotate(rad or deg) Rotates and item */
/* skew(x, y in deg/rad) skews and item */
/* matrix() Gives you exact control over an item */
/* You can chain tranforms together -webkit-transform: skew(15deg, 15deg) translate(20px, 20px) scale(.5, .5); */
//Ex. http://jsfiddle.net/TdMgm/1/
@mixin perspective($p: 800) {
//Use for the parent container when using translate3d function
-webkit-perspective: $p; }
@mixin transform($transform1: rotate(25deg), $transform2: scale(1, 1), $transform3: translate(0px, 0px)) {
//Options: translate(x, y), translateY, scale(.9, 2), scaleY, rotate(25deg), skew(10deg, 10deg)
//rotate3d(x,y,z, deg), rotateX(deg), rotateY(deg), rotateZ(deg), traslate3d(x, y, z) Only works in Safari
-webkit-transform: $transform1 $transform2 $transform3;
-moz-transform: $transform1 $transform2 $transform3;
-o-transform: $transform1 $transform2 $transform3;
transform: $transform1 $transform2 $transform3; }
@mixin transition_bezier($time: 500ms) {
-webkit-transition: all $time cubic-bezier(0, 1, 1, 1);
-moz-transition: all $time cubic-bezier(0, 1, 1, 1);
-o-transition: all $time cubic-bezier(0, 1, 1, 1);
transition: all $time cubic-bezier(0, 1, 1, 1); }
// SET THIS BEFORE THE ANMIATION
// @-webkit-keyframes $name
// from
// -webkit-transform: rotate(0deg)
// to
// -webkit-transform: rotate(30deg)
@mixin animation($name: myanim, $time: 2s, $count: 1, $delay: 0s) {
-webkit-animation: $name $time $count alternate ease-in-out $delay;
-moz-animation: $name $time $count alternate ease-in-out $delay;
-o-animation: $name $time $count alternate ease-in-out $delay;
animation: $name $time $count alternate ease-in-out $delay;
}
//-webkit-animation-name: $name
//-webkit-animation-duration: $time
//-webkit-animation-iteration-count: $count //Can ben 'infinite' or '1, 2, 3' etc.
//-webkit-animation-direction: alternate //
//-webkit-animation-timing-function: ease-in-out
//-webkit-animation-delay: $delay }