-
Notifications
You must be signed in to change notification settings - Fork 0
/
Drawing-App2.html
146 lines (131 loc) · 6.57 KB
/
Drawing-App2.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Drawing App</title>
<style>
.colorslist{
width: 15%;
position: absolute;
height: 40%;
border: 1px solid !important;
}
.setColor{
box-shadow: 0px 4px 4px 0px;
}
.bsizes{
width: 11%;
height: 80%;
border: 1px solid !important;
float: left;
margin: 0.5% 4%;
text-align: center;
font-size: 200%;
}
.brushsize{
background-image: url("images/brushsize.jpg");
}
.paintpallet1{
background-image: url("images/paint pallet.png");
}
</style>
<script src="js/jquery-1.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
// 0/1 = start/end
// 2 = state
// 3 = length, ms
// 4 = timer
// 5 = epoch
// 6 = disp el
// 7 = lap count
var t=[0, 0, 0, 0, 0, 0, 0, 1];
function ss() {
t[t[2]]=(new Date()).valueOf();
t[2]=1-t[2];
if (0==t[2]) {
clearInterval(t[4]);
t[3]+=t[1]-t[0];
var row=document.createElement('tr');
var td=document.createElement('td');
td.innerHTML=(t[7]++);
row.appendChild(td);
td=document.createElement('td');
td.innerHTML=format(t[1]-t[0]);
row.appendChild(td);
td=document.createElement('td');
td.innerHTML=format(t[3]);
row.appendChild(td);
//document.getElementById('lap').appendChild(row);
t[4]=t[1]=t[0]=0;
disp();
} else {
t[4]=setInterval(disp, 43);
}
}
function r() {
if (t[2]) ss();
t[4]=t[3]=t[2]=t[1]=t[0]=0;
disp();
document.getElementById('lap').innerHTML='';
t[7]=1;
}
function disp() {
if (t[2]) t[1]=(new Date()).valueOf();
t[6].innerHTML=format(t[3]+t[1]-t[0]);
//console.log(format(t[3]+t[1]-t[0]));
}
function format(ms) {
// used to do a substr, but whoops, different browsers, different formats
// so now, this ugly regex finds the time-of-day bit alone
var d=new Date(ms+t[5]).toString()
.replace(/.*([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*/, '$1');
var x=String(ms%1000);
while (x.length<3) x='0'+x;
//d+='.'+x;
d+='s';
//console.log(30-(d[6]+d[7]));
if(d[6]+d[7]=="30"){console.log("done");r();}
return "<div style='vertical-align: middle; text-align: center; height: 100%; width: 100%; display: table-cell; font-size: 200%;'><span>"+(30-(d[6]+d[7]))+"</span><span>s</span></div>";
}
function load() {
t[5]=new Date(1970, 1, 1, 0, 0, 0, 0).valueOf();
t[6]=document.getElementById('timer');
disp();
}
function remote() {
window.open(
document.location, '_blank', 'width=700,height=350'
);
return false;
}
</script>
</head>
<body style="margin: 0px;" onload="load();">
<div id="outlineimage" style='position: fixed; height: 100%; width: 100%; background-image: url("images/b.png"); background-repeat: no-repeat; background-position: center top; z-index: -1000; align-content: center;margin: auto;left: 0px;right: 0px;'>
<canvas id="theCanvas" style="display: block;margin-left: 12% ;margin-right: 12%;">
<h1>Your browser does not support the HTML5 Canvas Element.</h1>
</canvas>
<div id="drawingtools" style="position: absolute; bottom: 0px;left:0;margin-left: 12%; margin-right: 12%;bottom: 5%;">
<div id="brushes" class="elemfull" style='position: absolute; left:0%;width:30%' >
<div id="brush" class="elemfull drawingtool" style='position: absolute; left:0%;width:33.33%;background-image: url("images/clicked brush.png"); background-repeat: no-repeat; background-size: 100% 100%;'></div>
<div id="pen" class="elemfull drawingtool" style='position: absolute; left:33.33%;width:33.33%;background-image: url("images/pen.png"); background-repeat: no-repeat; background-size: 100% 100%;'></div>
<div id="sharper" class="elemfull drawingtool" style='position: absolute; left:66.66%;width:33.33%;background-image: url("images/pen2.png"); background-repeat: no-repeat; background-size: 100% 100%;'></div>
</div>
<div id="eraser" class="elemfull drawingtool" style='position: absolute; left:30%;width:10%;background-image: url("images/eraser .png"); background-repeat: no-repeat; background-size: 100% 100%;'></div>
<div id="paintpallet" class="elemhalf2 drawingtool paintpallet1" style='position:absolute; top:50%; left:40%;width:10%;fixed; background-repeat: no-repeat; background-size: 100% 100%;'></div>
<div id="timer" class="elemhalf2" style="position: absolute; top: 50%; left: 50%; width: 20%; background-repeat: no-repeat; text-align: center; vertical-align: middle; height: 58.75px; display: table;">
<div><span style="padding: 20% 0px 20% 40%;font-size: 200%;position: relative;">26</span><span>s</span></div>
</div>
<div id="reset_upload" onclick="r()" class="elemhalf2 timertool " style='position:absolute;top:50%; left:70%;width:15%; fixed; background-image: url("images/reset&upload.png"); background-repeat: no-repeat; background-size: 100% 100%;'></div>
<div id="start" onclick="ss()" class="elemhalf2 timertool" style='position: absolute;top:50%; left:85%;width:15%; background-image: url("images/start button.png"); background-repeat: no-repeat; background-size: 100% 100%;'></div>
<div id="paintpallet1" class="elemhalf1" style='position: absolute;top:; left:40%;width:60%;'>
<div style="left: 2%;" class="colorslist"></div><div style="left: 18%;background-color: rgb(0, 0, 0);" class="colorslist"></div><div style="left: 34%; background-color: rgb(129, 129, 129);" class="colorslist"></div><div style="left: 50%; background-color: rgb(193, 193, 193);" class="colorslist"></div><div style="left: 66%;background-color: rgb(255, 255, 255);" class="colorslist"></div><div style="left: 82%; background-color: rgb(166, 12, 0);" class="colorslist"></div>
<div style="left: 2%; top: 50%; background-color: rgb(220, 14, 2);" class="colorslist"></div><div style="top: 50%; left: 18%; background-color: rgb(239, 84, 2);" class="colorslist"></div><div style="top: 50%; left: 34%; background-color: rgb(247, 195, 16);" class="colorslist"></div><div style="top: 50%; left: 50%; background-color: rgb(242, 232, 80);" class="colorslist"></div><div style="top: 50%; left: 66%; background-color: rgb(208, 221, 16);" class="colorslist"></div><div style="top: 50%; left: 82%; background-color: rgb(184, 212, 35);" class="colorslist"></div>
</div>
<div id="brushsize" class="elemhalf1" style='position: absolute;top:; left:40%;width:60%;display:none;'>
<div class="bsizes">5</div><div class="bsizes">7</div><div class="bsizes">10</div><div class="bsizes">15</div><div class="bsizes">20</div>
</div>
<div>
</body></html>