Skip to content

Commit 6997fdf

Browse files
committed
re-worded some of the worker copy and moved the animating square to front-and-centre
1 parent 22497d7 commit 6997fdf

File tree

1 file changed

+33
-28
lines changed

1 file changed

+33
-28
lines changed

demos/worker.html

+33-28
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
11
<title>Web Worker</title>
22
<style>
3-
body {
4-
font-family: sans-serif;
5-
}
6-
7-
#status {
8-
height: 200px;
9-
max-height: 200px;
10-
border: thin solid black;
11-
overflow-y: scroll;
12-
}
13-
14-
#square {
15-
position: absolute;
16-
left: 0px;
17-
top: 0px;
18-
width: 75px;
19-
height: 75px;
20-
background-color: rgba(0, 0, 220, 0.3);
21-
z-index: -1;
22-
}
3+
body {
4+
font-family: sans-serif;
5+
}
6+
7+
#status {
8+
height: 200px;
9+
max-height: 200px;
10+
border: thin solid #aaa;
11+
overflow-y: scroll;
12+
}
13+
14+
#animationWrapper {
15+
position: relative;
16+
height: 50px;
17+
}
18+
19+
#square {
20+
position: absolute;
21+
left: 0px;
22+
top: 0px;
23+
width: 50px;
24+
height: 50px;
25+
background-color: rgba(0, 0, 220, 0.3);
26+
}
2327
</style>
2428
<article>
25-
<h1>Web Worker Demo</h1>
26-
<p>Works in Chrome, Safari, and Firefox. Web worker portion works in Opera.</p>
27-
<p>Use arrow keys to change the direction of the animated square. The square is animated with <em>requestAnimationFrame</em>.</p>
28-
<p>Click the button below to start or stop the worker.</p>
29-
<div><input type="button" value="start worker" id="toggleWorker" /></div>
30-
<h2>Messages from Worker:</h2>
31-
<div id="status"></div>
32-
<div id="square"></div>
29+
<p>This demo shows how main window animation isn't interrupted by Web Workers. <small>Note that the animation does not work in Opera (due to lack of requestAnimationFrame support).</small></p>
30+
<p>Use arrow keys to change the direction of the animated square. The square is animated with <em>requestAnimationFrame</em>.</p>
31+
<div id="animationWrapper">
32+
<div id="square"></div>
33+
</div>
34+
<p>Click the button below to start or stop the worker.</p>
35+
<div><input type="button" value="start worker" id="toggleWorker" /></div>
36+
<h2>Messages from Worker:</h2>
37+
<div id="status"></div>
3338
<script src="/js/worker-main.js"></script>
3439
</article>

0 commit comments

Comments
 (0)