-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcanvas.js
More file actions
54 lines (53 loc) · 1.4 KB
/
Copy pathcanvas.js
File metadata and controls
54 lines (53 loc) · 1.4 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
// Generated by CoffeeScript 1.4.0
var canvas;
canvas = {
canvasElement: null,
ctx: null,
width: 0,
height: 0,
isInitialized: function() {
return canvas.ctx != null;
},
initialize: function(element) {
canvas.canvasElement = element;
canvas.ctx = element.getContext('2d');
canvas.width = element.width;
return canvas.height = element.height;
},
clear: function() {
return canvas.ctx.clearRect(0, 0, canvas.width, canvas.height);
},
showSasai: function() {
var ctx;
ctx = canvas.ctx;
ctx.save();
ctx.font = 'italic 40pt Calibri';
ctx.shadowColor = 'orange';
ctx.shadowOffsetX = 3;
ctx.shadowOffsetY = 3;
ctx.fillText('SASAI LOLKA', ~~(canvas.width * 0.30), 100);
ctx.font = 'italic 10pt Calibri';
ctx.shadowColor = 'red';
ctx.shadowOffsetX = 1;
ctx.shadowOffsetY = 1;
ctx.fillText('Click to replay', ~~(canvas.width * 0.50), 130);
return ctx.restore();
},
drawYoba: function(params) {
var R, ctx, fi, position, src;
R = params.radius;
fi = params.angle;
src = params.src;
ctx = canvas.ctx;
position = params.position;
ctx.save();
ctx.translate(position - R, canvas.height - 2 * R);
ctx.translate(R, R);
ctx.rotate(fi);
ctx.drawImage(src, -R, -R, 2 * R, 2 * R);
return ctx.restore();
},
showTextAt: function(text, X, Y) {
return canvas.ctx.fillText(text, X, Y);
}
};