paper.js/examples/Tools/Circles.html

43 lines
1.7 KiB
HTML
Raw Normal View History

2011-02-08 07:16:43 -05:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<script type="text/javascript" src="../../src/Bootstrap.js"></script>
<script type="text/javascript" src="../../src/Paper.js"></script>
2011-02-08 07:16:43 -05:00
<script type="text/javascript" src="../../src/Item.js"></script>
<script type="text/javascript" src="../../src/PathItem.js"></script>
<script type="text/javascript" src="../../src/Point.js"></script>
<script type="text/javascript" src="../../src/Rectangle.js"></script>
<script type="text/javascript" src="../../src/Size.js"></script>
<script type="text/javascript" src="../../src/Segment.js"></script>
<script type="text/javascript" src="../../src/PathItem.js"></script>
<script type="text/javascript" src="../../src/Path.js"></script>
<script type="text/javascript" src="../../src/Doc.js"></script>
<script type="text/javascript" src="../../src/Layer.js"></script>
<script type="text/javascript" src="../../src/Group.js"></script>
2011-02-08 07:16:43 -05:00
<script type="text/javascript" src="../../src/ToolEvent.js"></script>
<script type="text/javascript" src="../../src/ToolHandler.js"></script>
<script type="text/javascript" src="../../src/Tool.js"></script>
<script>
window.onload = function() {
var canvas = document.getElementById('canvas');
var doc = new Doc(canvas);
var path;
2011-02-08 07:16:43 -05:00
var tool = new Tool({
onMouseDrag: function(event) {
if(path) path.remove();
var distance = event.downPoint.subtract(event.point).length;
path = new Path.Circle(event.downPoint, distance);
2011-02-08 07:16:43 -05:00
path.strokeColor = 'black';
path.fillColor = 'white';
}
});
tool.document = doc;
2011-02-08 07:16:43 -05:00
}
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
</body>