-
Notifications
You must be signed in to change notification settings - Fork 0
/
trafficnormal.html
56 lines (48 loc) · 1.76 KB
/
trafficnormal.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
<html>
<head>
<title>Dublin Trafic</title>
<link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no"/>
<meta name="description" content="Mobile optimised Dublin Traffic Cams" />
<meta name="keywords" content="Dublin, traffic, camera, livedrive, AA roadwatch, traffic cams" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<script type="text/javascript">
var cwidth = 300;
var cheight = 225;
var siteprefix = "http://trafficcam-fetcher.savina.net/serve_single_pic/";
var camera="Site0Camera137"; //variable to hold camera name
var img = new Image();
var ctx; //variable to hold the canvas
var maxpic = 4; // function diplays from the maxpic'th pic to the most recent
var picnum = maxpic; // variable holds the number of the pic being presently displayed
var maxpause = 2; // number frames to pause on the final image for
var pausetimer = maxpause;
function animatepic(){
ctx = document.getElementById('canvas1').getContext('2d');
setInterval(drawpic,1000); //calls the drawpic funtion every 1000 mileseconds
//drawpic();
}
function drawpic(){
img.src=siteprefix+camera+"/"+picnum;
ctx.clearRect(0,0,cwidth,cheight);
ctx.drawImage(img,0,0,cwidth,cheight);
// alert(img.src);
picnum = picnum-1;
if(picnum <0) //last pic logic if usunig
{
// pausetimer = pausetimer - 1;
// if( pausetimer <0)
// {
picnum=maxpic;
// pausetimer = maxpause;
// }
}
}
</script>
</head>
<body onLoad="animatepic();">
<canvas id="canvas1" width="1200" height="900">
This browser doesn't support the HTML5 canvas element.
</canvas>
</body>
</html>