-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
114 lines (107 loc) · 3.44 KB
/
demo.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
<html>
<head>
<title>PaintBrush Application Demo</title>
<style type="text/css">
h1 {
font-size: 20px;
font-weight: bold;
}
#canvas-display {
border: solid 1px greenyellow;
cursor: crosshair;
float: left;
}
#colors {
background-color: #fff;
border: 1px solid #000000;
display: none;
float: left;
left: -55px;
margin-top: 10px;
padding: 0;
position: relative;
width: 50px;
}
#colors li {
border: 1px solid #000000;
height: 20px;
width: 20px;
cursor: pointer;
float: left;
margin: 1px;
list-style: none;
}
#colors li.selected {
border: solid 1px #eee;
}
#controls {
background: none repeat scroll 0 0 grey;
border: 1px solid;
border-radius: 5px 5px 5px 5px;
cursor: pointer;
font-weight: bold;
margin-left: -72px;
opacity: 0.7;
padding: 5px;
position: relative;
top: 5px;
}
#control-buttons {
background-color: gray;
border: 1px solid #000000;
border-radius: 5px 5px 5px 5px;
display: none;
float: left;
margin-left: 1px;
margin-top: -78px;
opacity: 0.7;
padding: 10px;
position: relative;
width: 378px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="jquery.paintBrush.js" type="text/javascript"></script>
</head>
<body>
<h1>Free Hand Drawer using HTML5 Canvas</h1>
<span id="controls">Controls</span>
<canvas id="canvas-display" width="400" height="400" ></canvas>
<br/>
<ul id="colors">
<li style="background-color:black;"> </li>
<li style="background-color:red;"> </li>
<li style="background-color:green;"> </li>
<li style="background-color:orange;"> </li>
<li style="background-color:brown;"> </li>
<li style="background-color:#d2232a;"> </li>
<li style="background-color:#fcb017;"> </li>
<li style="background-color:#fff460;"> </li>
<li style="background-color:#9ecc3b;"> </li>
<li style="background-color:#fcb017;"> </li>
<li style="background-color:#fff460;"> </li>
<li style="background-color:#F43059;"> </li>
<li style="background-color:#82B82C;"> </li>
<li style="background-color:#0099FF;"> </li>
<li style="background-color:#ff00ff;"> </li>
</ul>
<br style="clear:both;"/>
<br style="clear:both;"/>
<div id="control-buttons">
<div style="float:left;">
<button id="undo" href="#" disabled="disabled">Undo</button>
<button id="clear" href="#">Reset</button>
<button id="export" href="#">Save as Image</button>
</div>
<div style="float:left;margin-left: 22px;text-align: center;width: 130px;">
Brush Size:<br />
<input name="brush" id="brush_size" type="range" value="5" min="0" max="20" />
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#canvas-display').paintBrush();
});
</script>
</body>
</html>