-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpopulationStatusAvatar.html
More file actions
88 lines (74 loc) · 2.48 KB
/
Copy pathpopulationStatusAvatar.html
File metadata and controls
88 lines (74 loc) · 2.48 KB
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
<html>
<head>
<!-- load libraries -->
<script type="text/javascript" src="JS/jquery-1.9.1.min.js"></script>
<!-- load globals -->
<script type="text/javascript" src="JS/globals.js"></script>
<!-- load countly JSON -->
<script type="text/javascript">
var JSONurl="http://testsubdomain.socialvinesolutions.com/o"+
"?api_key=f9260de6b6495ee559b8f951109d3959"+
"&app_id=510892b53f3f90f302000001"+
"&method=events"+
"&event=physicalActivity"+
"&action=refresh";
$.ajax({
type: 'GET',
dataType: "JSONP",
url: JSONurl,
success: function(data){
//these are current time info: (TODO: get these programmatically)
var hr = 21; //this can be any hour so far today, but the rest (y,m,d) MUST be today only
var day = 15;
var mon = 9;
var yr = 2013
console.log("all data:");
console.log(data);
//print out each UID
console.log(data[0]._id); //this should be "UID"
for (uid in data[0][yr][mon][day]){
console.log(uid);
}
//print out current population activity summary
console.log("current hour's data:");
console.log(data[1][yr][mon][day][hr]);
var sum = data[1][yr][mon][day][hr].s;
var count = data[1][yr][mon][day][hr].c;
ACTIVE_LEVEL = sum/count;
console.log("activeLevel:"+ACTIVE_LEVEL);
}
});
</script>
<!-- load javascript functions -->
<script src="JS/avatarEmbiggener.js"></script>
<script src="JS/avatarInserter.js"></script>
<script src="JS/animateAvatar.js"></script>
<!-- define what the page does onload -->
<script type="text/javascript">
function startup(){
var avatarName = "the collective avatar";
//set global stuff
ANIMATION_SPEED[0] = Math.floor((ACTIVE_LEVEL*300)+10);
CURRENT_FRAME[0] = 0;
ANIMATION_ACTIVITY[0] = getAnimationName(0);
FACE_IMAGE[0] = 'images/faces/default.png';
insertAvatarCanvas(avatarName, 0);
}
</script>
</head>
<body onload="startup()" bgcolor="#C4C4C0">
<h1>Current Collective Avatar:</h1>
<div id="avatars">
<!-- will look something like:
<canvas id="avatar0" height="300" width="300" onclick="drawAvatarAnim()"></canvas>
in older versions:
<canvas id="avatar1" height="100" width="100"></canvas>
even older:
<image id='avatar2' src='images/animations/running/0.png' /> -->
</div>
<button type="button" onclick="insertImage(animationSize)">add avatar</button>
<!-- <button type="button" onclick="oneFrameAll()">animate avatars</button>
-->
<input type="submit" name="increment" value="Increment" />
</body>
</html>