paper.js/examples/Tools/Clouds.html
2011-02-08 13:16:43 +01:00

43 lines
No EOL
1.6 KiB
HTML

<!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/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/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;
var tool = new Tool({
onMouseDown: function(event) {
path = new Path();
path.strokeColor = 'black';
path.add(event.getPoint());
doc.children.push(path);
},
onMouseDrag: function(event) {
path.arcTo(event.getPoint(), true);
}
});
tool.setDocument(doc);
tool.setMinDistance(30);
}
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
</body>