-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (100 loc) · 3.64 KB
/
index.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Weresch.net</title>
<script type="text/javascript">
var canvas_w=100;
var canvas_h=100;
function resize() {
var d_canvas = document.getElementById("d");
var context = d_canvas.getContext("2d");
var screenSize = get_screen_size();
if (screenSize[0] > 130) canvas_w=screenSize[0]-30;
if (screenSize[1] > 130) canvas_h=screenSize[1]-30;
if (screenSize[0] > 2000) canvas_w=2000;
if (screenSize[1] > 1000) canvas_h=1000;
clearCanvas(context, d_canvas);
init();
}
function get_screen_size() {
var w=document.documentElement.clientWidth;
var h=document.documentElement.clientHeight;
return Array(w,h);
}
function clearCanvas(context, canvas) {
context.clearRect(0, 0, canvas.width, canvas.height);
var w = canvas.width;
canvas.width = 1;
canvas.width = w;
context.beginPath();
}
function init(){
var d_canvas = document.getElementById("d");
var context = d_canvas.getContext("2d");
var topLeftGradient = context.createRadialGradient(0, 0, canvas_w/3, 0, 0, canvas_w*1.5);
topLeftGradient.addColorStop(0, "black");
topLeftGradient.addColorStop(1, "darkgreen");
context.fillStyle = topLeftGradient;
context.fillRect(0, 0, canvas_w/2, canvas_h/2);
var topRightGradient = context.createRadialGradient(canvas_w, 0, canvas_w/3, canvas_w, 0, canvas_w*1.5+25);
topRightGradient.addColorStop(0, "black");
topRightGradient.addColorStop(1, "darkgreen");
context.fillStyle = topRightGradient;
context.fillRect(canvas_w/2, 0, canvas_w/2, canvas_h/2);
var bottomLeftGradient = context.createRadialGradient(0, canvas_h, canvas_w/3, 0, canvas_h, canvas_w*1.5);
bottomLeftGradient.addColorStop(0, "black");
bottomLeftGradient.addColorStop(1, "darkgreen");
context.fillStyle = bottomLeftGradient;
context.fillRect(0, canvas_h/2, canvas_w/2, canvas_h/2);
var bottomRightGradient = context.createRadialGradient(canvas_w, canvas_h, canvas_w/3, canvas_w, canvas_h, canvas_w*1.5+25);
bottomRightGradient.addColorStop(0, "black");
bottomRightGradient.addColorStop(1, "darkgreen");
context.fillStyle = bottomRightGradient;
context.fillRect(canvas_w/2, canvas_h/2, canvas_w/2, canvas_h/2);
context.moveTo(1, 0);
context.lineTo(1, canvas_h);
var x = canvas_w/2;
var diff = 10;
while (x > 0) {
context.moveTo(x, 0);
context.lineTo(x, canvas_h);
x = x - diff;
diff = diff / 0.66;
}
x = canvas_w/2;
diff = 10;
while (x < canvas_w) {
context.moveTo(x, 0);
context.lineTo(x, canvas_h);
x = x + diff;
diff = diff / 0.66;
}
context.moveTo(canvas_w-1, 0);
context.lineTo(canvas_w-1, canvas_h);
context.moveTo(0, 1);
context.lineTo(canvas_w, 1);
var y = canvas_h/2;
while (y > 0) {
context.moveTo(0, y);
context.lineTo(canvas_w, y);
y = y - 100;
}
y = canvas_h/2;
while (y < canvas_h) {
context.moveTo(0, y);
context.lineTo(canvas_w, y);
y = y + 100;
}
context.moveTo(0, canvas_h-1);
context.lineTo(canvas_w, canvas_h-1);
context.strokeStyle = "#1E4D2B"; //http://en.wikipedia.org/wiki/Variations_of_green
context.stroke();
}
</script>
</head>
<body onload="resize()" onresize="resize()" onorientationchange="resize()" bgcolor="black">
<div style="width:2000px; height:1000px; margin: 0 auto; padding: 5px;">
<canvas id="d" width="2000" height="1000"><img src="nyancat.gif" alt="Your browser doesn't support canvas!" /></canvas>
</div>
</body>
</html>