-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider.html
48 lines (41 loc) · 994 Bytes
/
slider.html
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
<!DOCTYPE html>
<html>
<head>
<title>Animation</title>
<style type="text/css">
html,
body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
#slider {
width: 50%;
height: 100%;
background: #1e4ff7;
-webkit-transition: width 1s ease-in-out, visibility 1s linear;
-moz-transition: width 1s ease-in-out, visibility 1s linear;
-o-transition: width 1s ease-in-out, visibility 1s linear;
transition: width 1s ease-in-out, visibility 1s linear;
}
</style>
</head>
<body>
<div id="slider"></div>
</body>
<script type="text/javascript">
let anim = document.getElementById("slider");
function rand(min, max) {
return Math.random() * (max - min) + min;
};
function rand_float() {
return Math.random();
}
! function repeat() {
anim.style.width = `${rand(0, 101)}%`;
setTimeout(repeat, 1000);
}();
</script>
</html>