-
Notifications
You must be signed in to change notification settings - Fork 2
/
chronometer.html
241 lines (210 loc) · 7.94 KB
/
chronometer.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!DOCTYPE html>
<html>
<head>
<title>Artemis - Mission Time Clock</title>
<meta charset="utf-8" />
<meta name="description" content="Faux GUI supplement for set-dressing a gaming session of Artemis SBS." />
<meta name="author" content="Justin Warwick" />
<meta name="mobile-web-app-capable" content="yes" />
<link rel='stylesheet' href='./sbs-ui.css' />
<!-- Here would be a good place to put your own additional css link for unique/special things like spacing adjsutments based on element ID. The fewer changes in sbs-ui.css, the better (esp. if you might want to share improvements that really are general purpose) -->
<style>
#chrono_container {
padding-left: 2em;
}
.timedisplay {
margin-right: 1em;
display:inline-block;
width:3.25em;
}
/* CSS Animated circle clock */
.timeCycWrapper {
position: relative;
display:inline-block;
margin: 1.5em 2em;
background: #00001C;
}
.timeCycWrapper, .timeCycWrapper * {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.timeCycWrapper {
width: 3em; /* <-- Main size control here */
height: 3em;
}
.timeCycWrapper .pie {
width: 50%;
height: 100%;
transform-origin: 100% 50%;
position: absolute;
background: #00001C;
border: .33em solid #DDA050; /* <-- Main color control here */
}
.timeCycWrapper .spinner {
border-radius: 100% 0 0 100% / 50% 0 0 50%;
z-index: 200;
border-right: none;
animation: rota 10.888s linear infinite;
}
.timeCycWrapper:hover .spinner,
.timeCycWrapper:hover .filler,
.timeCycWrapper:hover .mask {
animation-play-state: running;
}
.timeCycWrapper .filler {
border-radius: 0 100% 100% 0 / 0 50% 50% 0;
left: 50%;
opacity: 0;
z-index: 100;
animation: opa 10.888s steps(1, end) infinite reverse;
border-left: none;
}
.timeCycWrapper .mask {
width: 50%;
height: 100%;
position: absolute;
background: inherit;
opacity: 1;
z-index: 300;
animation: opa 10.888s steps(1, end) infinite;
}
@keyframes rota {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes opa {
0% {
opacity: 1;
}
50%, 100% {
opacity: 0;
}
}
</style>
<script src="./sbs-ui.js"></script>
</head>
<body>
<div id="super_container">
<div id="console_metacontrols">
<a href="javascript:toggleFullScreen();" id="fullscreenToggle">[=]</a>
</div>
<div id="console_super_controls">
<button class="major_action" onclick="window.location.href='menu.html';">MENU</button>
<button class="major_action major_action_active" onclick="javascript:g_clockActive=true;">START</button>
<button class="major_action" onclick="javascript:g_clockActive=false;">HALT</button>
<button class="major_action" onclick="javascript:missionMark=0;">RESET</button>
</div>
<div id="communique" >
<h1>Welcome to Artemis Glitter UI Style Clone Test</h1>
<p>Status and information flowing endlessly, giving a certain ambience.</p>
<p>Even if information is not functionally meaningful, the experience is enhance by giving a feeling of authenticity.</p>
<p>Presumably, you want to fill the screen pretty evenly, if browser were in fullscreen mode. But also becareful not to overflow or else you get scrollbars that spoil the effect a little. Hopefully this page is clean and clear enough that you could copy it, rename it, then start copy and pasting segments that you like and just replace the content and order a little and then you have yourself a custom faux console.</p>
<button class="action" onclick="javascript:this.parentNode.style.display = 'none';">ACKNOWLEDGE</button>
<!--Probably it is better to put onclick and other evenhandler code in a seperate script block, even in a separate JS file. But this works ok too.-->
</div>
<div id="chrono_container">
<div>
<h3>UTC</h3>
<span id="UTCTime" class="jumbo timedisplay">HH:MI:SS</span>
<div class="timeCycWrapper">
<div class="pie spinner"></div>
<div class="pie filler"></div>
<div class="mask"></div>
</div>
<h3>Local Time</h3>
<span id="LocalTime" class="jumbo timedisplay">HH:MI:SS</span>
<div class="timeCycWrapper">
<div class="pie spinner"></div>
<div class="pie filler"></div>
<div class="mask"></div>
</div>
<h3>Mission Time Mark</h3>
<span id="MissionTimeMark" class="jumbo timedisplay">HH:MI:SS</span>
<div class="timeCycWrapper">
<div class="pie spinner"></div>
<div class="pie filler"></div>
<div class="mask"></div>
</div>
<h3>Time Remaining</h3>
<span id="MissionTimeRemain" class="jumbo timedisplay">HH:MI:SS</span>
<div class="timeCycWrapper">
<button class="increment" onclick="missionLength+=60;"> </button>
<button class="decrement" onclick="missionLength-=60;"> </button>
</div>
</div>
</div>
<div id="dualpresentation2" class="wrapper2column">
<div class="leftcolumn">
<table class="vertical_threshold_bracket">
<tr><td class="critical_threshold">_</td></tr>
<tr><td class="critical_threshold">_</td></tr>
<tr><td>—</td></tr>
<tr><td>-</td></tr>
</table>
</div>
<div class="rightcolumn">
<p>Relativisitic time dilation factor: 2.718</p>
<p>modulated sine wave calculating...</p>
</div>
</div>
</div>
<audio id="audUmmy"/><!--Just leave this here, just needed to be able to query canplay in the initialization code to load compatible media types -->
<script>
window.console && console.log("TODO some dynamicness");
function termAlert() {
audioAlert();
//redify other stuff?
}
var missionLength = 900 ; //seconds, so 15 minutes = 900
var missionMark = 0; //seconds
var etc = new Date(Date.now() + missionLength * 1000);
var dt0 = new Date(Date.now());
var metricSecondFactor = (10000000000 / 9192631770); //SI cesium oscillation basis, but rounded up to a nice power of 10
var g_clockActive = true;
var tid = window.setInterval(function(){
//These first two are "immune" to halt/resume
var dt = new Date(Date.now());
var HH = "0" + dt.getHours();
var mm = "0" + dt.getMinutes();
var ss = "0" + dt.getSeconds();
document.getElementById("LocalTime").innerHTML = HH.substr(HH.length - 2) + ":" + mm.substr(mm.length - 2) + ":" + ss.substr(ss.length - 2);
var HH = "0" + dt.getUTCHours();
var mm = "0" + dt.getUTCMinutes();
var ss = "0" + dt.getUTCSeconds();
document.getElementById("UTCTime").innerHTML = HH.substr(HH.length - 2) + ":" + mm.substr(mm.length - 2) + ":" + ss.substr(ss.length - 2);
//Relative time elements. Well maybe "arbitrarily relative" or something.
remain = (missionLength - missionMark) ;
if (remain < 0) {
document.getElementById("MissionTimeRemain").style.color = "#DF3030";
if (remain % 10 == -1 ) {
termAlert();
}
remain = -1 * remain;
}
document.getElementById("MissionTimeRemain").innerHTML = ((missionLength - missionMark) < 0 ? '-' : '')
+ ('0' + Math.floor(remain / 3600)).slice(-2) + ":"
+ ('0' + (Math.floor(remain / 60) % 60)).slice(-2) + ":"
+ ('0' + (remain % 60)).slice(-2);
document.getElementById("MissionTimeMark").innerHTML = ('0' + Math.floor(missionMark / 3600)).slice(-2) + ":"
+ ('0' + (Math.floor(missionMark / 60) % 60)).slice(-2) + ":"
+ ('0' + (missionMark % 60)).slice(-2);
if (g_clockActive ) { //i.e., is game and clock in "HALT"/pause mode?
missionMark ++;
//TODO: mission time mark's visual clock circle should also pause.
}
//TODO: if "paused" then add one second to the etc
if ( missionMark % 109 == 0 ) { //this is a gross approximation of the factor * 100 metricseconds to get a hectosecond
console.log("one 'metric' minute or 'hectosecond' has passed.");
//earlier on, we have a css animation that uses a slightly better approximation for the ring period counter, which is one dekasecond
}
}, 1000);
//sync up with beginning of clock run?//document.getElementByID("timeCycWrapper").animation-play-state: paused;
</script>
<script src="sbs-ui-wireup.js"></script>
</body>
</html>