-
Notifications
You must be signed in to change notification settings - Fork 0
/
color.html
72 lines (65 loc) · 2.89 KB
/
color.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
<!DOCTYPE html>
<html>
<head>
<title>HCL Viewer</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bower_components/jquery-ui/themes/smoothness/jquery-ui.min.css">
<script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="bower_components/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="bower_components/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="bower_components/three.js/build/three.min.js"></script>
<script type="text/javascript" src="hclController.js"></script>
<script type="text/javascript" src="lch2rgb.js"></script>
<script type="text/javascript" src="data.js"></script>
<script type="text/javascript" src="colorSurface.js"></script>
<script type="text/javascript" src="colorCanvas.js"></script>
<link rel="stylesheet" href="color.css">
</head>
<body>
<h3>HCL Viewer</h3>
<div id="topContainer" style="height:500px">
<div class="modebox">
<span class="slabel">Mode:</span>
<span class="modeBtn" id="clBtn"><span class="btnLbl">CxL</span></span>
<span class="modeBtn" id="hlBtn"><span class="btnLbl">HxL</span></span>
<span class="modeBtn" id="hcBtn"><span class="btnLbl">HxC</span></span>
</div>
<div class='sliderbox'><span class="slabel">H</span><span class="svalue" id="hvalue"></span><div id="hSlider" class="hclSlider"></div></div>
<div class='sliderbox'><span class="slabel">C</span><span class="svalue" id="cvalue"></span><div id="cSlider" class="hclSlider"></div></div>
<div class='sliderbox'><span class="slabel">L</span><span class="svalue" id="lvalue"></span><div id="lSlider" class="hclSlider"></div></div>
<div id="threed"></div><canvas id="canvas" ></canvas>
<p><a href="notes.html">Implementation notes.</a></p>
</div>
<script type="text/javascript">
var canvasWidth, canvasHeight;
var responsiveListeners = [];
function addResponsiveListener(list) {
responsiveListeners.push(list);
}
$(window).resize(function() {
calcCanvasSize();
responsiveListeners.forEach(function(list) {
list();
});
})
function calcCanvasSize() {
var w = window.innerWidth;
if (w < 500) {
// canvasWidth = canvasHeight = Math.floor(w*0.7);
canvasWidth = canvasHeight = Math.floor(Math.min(w-10, window.innerHeight*0.5));
} else if (w < 768) {
canvasWidth = canvasHeight = Math.floor(w * 0.45);
} else {
canvasWidth = canvasHeight = Math.floor((w - 220) * 0.5);
// canvasWidth = canvasHeight = Math.min(window.innerWidth*0.35, 500);
}
$('#threed').css({'width': canvasWidth + 'px', 'height': canvasHeight + 'px'});
$('#canvas').css({'width': canvasWidth + 'px', 'height': canvasHeight + 'px'});
}
calcCanvasSize();
var hclController = hcl_controller();
buildColorSurface();
buildColorCanvas();
</script>
</body>
</html>