-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsliders.html
123 lines (91 loc) · 3.22 KB
/
sliders.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
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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>sliders</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
}
#sky {
height: 100%;
width: 100%;
background: linear-gradient(175deg, red, blue);
position: absolute;
z-index: 1;
transition: all 1s ease;
}
#earth {
position: absolute;
left: 0px;
bottom: 0px;
height: 30%;
width: 100%;
background: #666;
z-index: 2;
background: linear-gradient(150deg, #777, #111);
}
#building, #small-building {
background: #444;
position: absolute;
right: 20%;
width: 10%;
bottom: 20%;
height: 50%;
z-index: 3;
background: linear-gradient(150deg, #666, #222);
}
#small-building {
height: 40%;
right: 38%;
bottom: 22%;
width: 9%
}
#control {
left: 10%;
bottom: 10%;
position: absolute;
z-index: 10;
}
input {
display: block;
clear: left;
height: 2em;
}
</style>
</head>
<body>
<div id="sky"></div>
<div id="control">
<input type="range" min="-180" max="180" value="0" id="faderA"
step="1" oninput="outputUpdateA(value)">
<input type="range" min="0" max="360" value="240" id="faderB"
step="1" oninput="outputUpdateB(value)">
</div>
<div id="building"></div>
<div id="small-building"></div>
<div id="earth"></div>
</body>
<script>
var sky = document.getElementById('sky');
function outputUpdateA(vol) {
var color = 'hsl('+vol+', 100%, 50%)';
var othercolor = document.getElementById('faderB').value;
var othercolor = 'hsl('+othercolor+', 100%, 50%)';
var gradient = "linear-gradient(175deg, "+color+", "+othercolor+")";
sky.style.background=gradient;
}
function outputUpdateB(vol) {
var color = 'hsl('+vol+', 100%, 50%)';
var othercolor = document.getElementById('faderA').value;
var othercolor = 'hsl('+othercolor+', 100%, 50%)';
var gradient = "linear-gradient(175deg, "+othercolor+", "+color+")";
sky.style.background=gradient;
}
// see
// http://thenewcode.com/757/Playing-With-The-HTML5-range-Slider-Input
// http://www.html5tutorial.info/html5-range.php
</script>
</html>