JSDM

HTML

 
1
<h1>Comparing animation-timing-functions</h1>
2
<div class="container">
3
  <div class="loading-bar option1">
4
    <div class="loading"></div>
5
  </div>
6
  <div class="loading-bar option2">
7
    <div class="loading"></div>
8
  </div>
9
  <div class="loading-bar option3">
10
    <div class="loading"></div>
11
  </div>
12
  <div class="loading-bar option4">
13
    <div class="loading"></div>
14
  </div>
15
  <div class="loading-bar option5">
16
    <div class="loading"></div>
17
  </div>
18
  <div class="loading-bar option6">
19
    <div class="loading"></div>
20
  </div>
21
</div>
!

CSS

x
 
1
2
3
$bar: 20px;
4
$foo: $bar * 16;
5
$color: #c5cae9;
6
7
body {
8
  background: #1a237e;
9
  font-family: 'Source Sans Pro';
10
  font-weight: 400;
11
  font-size: 22px;
12
  line-height: 1em;
13
  color: $color;
14
}
15
16
.container {
17
  margin: 0 auto; // rough center
18
  width: $foo;
19
  padding: 0 0 10px 10px;
20
  height: auto;
21
  border: solid $color;
22
  border-width: 0 0 1px 1px;
23
}
24
25
h1 {
26
  text-align: center;
27
  font-weight: 700;
28
  line-height: 1em;
29
}
30
31
.loading-bar {
32
  position: relative;
33
  width: $foo;
34
  height: $bar;
35
  margin-top: 70px;
36
  top: -1 * $bar;
37
  
38
  &:before {
39
    position: relative;
40
    top: $bar;
41
    left: -300px - 20;
42
    display: block;
43
    width: 300px;
44
    content: '';
45
    text-align: right;
46
    text-transform: lowercase;
47
  }
48
  
49
  &.option1 {
50
    &:before {
51
      content: 'Linear';
52
    }
53
    .loading {
54
      animation-timing-function: linear;
55
    }
56
  }
57
  &.option2 {
58
    &:before {
59
      content: 'Ease-in';
60
    }
61
    .loading {
62
      animation-timing-function: ease-in;
63
    }
64
  }
65
  &.option3 {
66
    &:before {
67
      content: 'Ease-out';
68
    }
69
    .loading {
70
      animation-timing-function: ease-out;
71
    }
72
  }
73
  &.option4 {
74
    &:before {
75
      content: 'Ease';
76
    }
77
    .loading {
78
      animation-timing-function: ease;
79
    }
80
  }
81
  &.option5 {
82
    &:before {
83
      content: 'Steps(4)';
84
    }
85
    .loading {
86
      animation-timing-function: steps(4);
87
    }
88
  }
89
  &.option6 {
90
    &:before {
91
      content: 'cubic-bezier(0,1,1,0)';
92
    }
93
    .loading {
94
      animation-timing-function: cubic-bezier(0,1,1,0);
95
    }
96
  }
97
  
98
  .loading {
99
    position: relative;
100
    width: $bar;
101
    height: $bar;
102
    background: $color;
103
    animation: grow 4s linear infinite, move 4s linear infinite;
104
  }
105
}
106
107
@keyframes move {
108
  0%    { left: 0           ; }
109
  16.7% { left: 0           ; }
110
  33.3% { left: $foo / 2    ; }
111
  50%   { left: $foo - $bar ; }
112
  66.7% { left: $foo / 2    ; }
113
  83.3% { left: 0           ; }
114
  100%  { left: 0           ; }
115
}
116
117
@keyframes grow {
118
  0%    { width: $bar     ; }
119
  16.7% { width: $foo / 2 ; }
120
  33.3% { width: $foo / 2 ; }
121
  50%   { width: $bar     ; }
122
  66.7% { width: $foo / 2 ; }
123
  83.3% { width: $foo / 2 ; }
124
  100%  { width: $bar     ; }
125
}
!
? ?
? ?
必须是有效的URL
+ 添加另一个资源

JS

xxxxxxxxxx
1
 
1
!
必须是有效的URL
+ 添加另一个资源
Close

文件管理 点击文件查看URL

图片

  1. 暂无文件

CSS

  1. 暂无文件

JavaScript

  1. 暂无文件

其他

  1. 暂无文件
拖动文件到上面的区域或者:
加载中 ..................