-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathexample.scss
136 lines (114 loc) · 1.97 KB
/
example.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
// -- variables --
$boxLeft: 20px;
$boxGap: 140px;
$boxTopEnd: 500px;
// -- mixins for CSS animation/transition --
@mixin animation($value) {
-o-animation: $value;
-webkit-animation: $value;
animation: $value;
}
@mixin keyframes($name) {
@-o-keyframes #{$name} { @content; }
@-webkit-keyframes #{$name} { @content; }
@keyframes #{$name} { @content; }
}
@mixin transition($value...) {
-o-transition: $value;
-webkit-transition: $value;
transition: $value;
}
// -- base --
input {
font-size: 100%;
margin: 0;
}
body,
input {
color: #000;
font-family: sans-serif;
}
body {
background: #fff;
font-size: 62.5%;
line-height: 1;
margin-left: $boxLeft;
margin-right: $boxLeft;
}
h1 {
font-size: 3em;
margin: 0 0 20px;
white-space: nowrap;
}
p {
font-size: 1.3em;
line-height: 1.4;
margin: 0 0 15px;
max-width: 700px;
}
p > strong {
white-space: nowrap;
}
a {
color: #555;
}
// -- boxes --
.boxanimation,
.boxtransition1,
.boxtransition2 {
border: 1px solid #000;
height: 100px;
left: $boxLeft;
position: absolute;
top: 260px;
width: 100px;
// add a red box to each box as it's animating
&.cssanimactive {
border: 1px solid #f00;
}
}
// -- boxes - animation --
.boxanimation {
background: #b2382d;
&.move {
@include animation(boxanimation 1s ease-in-out 0s 3 alternate forwards);
}
// for browsers that don't support animation, place box at intended end position
&.complete {
left: $boxLeft;
top: $boxTopEnd;
}
@at-root {
@include keyframes(boxanimation) {
20% {
left: 40px;
top: 310px;
}
40% {
left: 140px;
top: 400px;
}
60% {
background: #ffc787;
}
100% {
background: #e89041;
top: $boxTopEnd;
}
}
}
}
// -- boxes - transition --
.boxtransition1,
.boxtransition2 {
background: #f2df7e;
left: ($boxLeft + $boxGap);
@include transition(background 0.5s linear,top 0.5s ease-in);
&.move {
background: #314a59;
top: $boxTopEnd;
}
}
.boxtransition2 {
left: ($boxLeft + ($boxGap * 2));
}