Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (34 sloc) 1 KB
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Segment</title>
<link rel="stylesheet" href="../include/style.css">
</head>
<body>
<header>
Example from <a href="http://amzn.com/1430236655?tag=html5anim-20"><em>Foundation HTML5 Animation with JavaScript</em></a>
</header>
<canvas id="canvas" width="400" height="400"></canvas>
<script src="../include/utils.js"></script>
<script src="./classes/segment.js"></script>
<script>
window.onload = function () {
var canvas = document.getElementById('canvas'),
context = canvas.getContext('2d'),
segment0 = new Segment(100, 20),
segment1 = new Segment(200, 10),
segment2 = new Segment(80, 40);
segment0.x = 100;
segment0.y = 50;
segment0.draw(context);
segment1.x = 100;
segment1.y = 80;
segment1.draw(context);
segment2.x = 100;
segment2.y = 120;
segment2.draw(context);
};
</script>
</body>
</html>