canva-tree/index.html
2024-06-05 23:00:24 +02:00

39 lines
693 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Canvas</title>
<!-- <link rel="stylesheet" href="css/style.css"> -->
<style>
canvas {
background: #eee;
display: block;
margin: 0 auto;
}
p { width: 800px; margin: 0 auto; }
ol { width: 800px; margin: 0 auto; }
</style>
</head>
<body>
<section>
<h1 align="center">Recursive tree</h1>
<p>Renew the page to see another tree</p>
</section>
<canvas id="tree" width="1000" height="750"></canvas>
<script src="tree.js"></script>
<script>
var canvas = document.getElementById("tree");
ctx = canvas.getContext("2d");
tree(ctx, canvas.width/2, canvas.height, 200);
</script>
</body>
</html>