-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbird.js
42 lines (34 loc) · 1.06 KB
/
bird.js
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
if (Meteor.isClient) {
//// counter starts at 0
//Session.setDefault('counter', 0);
//
Template.bird.helpers({
counter: function () {
return Session.get('counter');
}
});
//
//Template.bird.events({
// 'click': function () {
// // increment the counter when button is clicked
// Session.set('counter', Session.get('counter') + 2);
// }
//});
draw = function(position, frame, seed) {
var canvas = $("#bird-canvas");
var context = document.getElementById('bird-canvas').getContext('2d');
canvas.attr('width', $(window).width());
canvas.attr('height', $(window).height());
context.fillStyle = "#FFFFFF";
context.fillRect(0, 0, canvas.width(), canvas.height());
drawLevel(context,seed,frame);
var bird = new Image();
bird.src = "/bird.svg";
bird.width = 45;
bird.height = 52;
context.fillStyle = 'red';
console.log(position);
var maxHeight = (canvas.height() - bird.height);
context.drawImage(bird, 20, maxHeight - maxHeight * (position / 100), bird.width, bird.height);
};
}