-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
39 lines (32 loc) · 867 Bytes
/
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
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Zen Tree</title>
<link href='http://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<h1>Zen Tree</h1>
<div id="content"></div>
<button id="change">I don`t like this tree. Get me new one!</button>
<script src="tree.js"></script>
<script>
// canvas element and 2D context
var canvas = document.createElement('canvas');
canvas.width = 800;
canvas.height = 400;
var c = canvas.getContext('2d');
c.translate(400, 350);
var tree = TreeGenerator({
context : c,
generations : 11
});
var container = document.getElementById('content');
container.appendChild(canvas);
var trigger = document.getElementById('change');
trigger.addEventListener('click', tree.create, false);
tree.create()
</script>
</body>
</html>