-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-animation4.html
65 lines (51 loc) · 1.5 KB
/
test-animation4.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Muybridge IIIF Text</title>
</head>
<body>
<canvas id="Canvas1" width="600" height="400" style="border:5px solid green;">
Canvas is not supported in your browser
</canvas>
<script>
var canvas;
var context;
var photo;
var timer;
// var count = 0;
var images = [
'https://stacks.stanford.edu/image/iiif/sk408hr4162%2Fsk408hr4162/2140,453,1767,1949/,400/0/default.jpg',
'https://stacks.stanford.edu/image/iiif/sk408hr4162%2Fsk408hr4162/202,441,1767,1949/,400/0/default.jpg'
];
// window.onload = function() {
// var c = document.getElementById("Canvas1");
// var ctx = c.getContext("2d");
// var img = new Image();
// img.src = images[0];
// // document.write(images[0]);
// img.onload = function() {
// ctx.drawImage(img, 0, 0);
// }
// };
function StartAnimation() {
img = new Image();
canvas = document.getElementById("Canvas1");
context = canvas.getContext("2d");
AnimateNow();
// timer = setInterval(AnimateNow, 100);
}
function AnimateNow() {
var count = Math.round(Math.random());
// document.write(count);
img.src = images[count];
// document.write(img.src);
img.onload = function() {
context.drawImage(img, 0, 0);
};
timer = setTimeout(AnimateNow, 75);
}
StartAnimation();
</script>
</body>
</html>