paper.js/examples/Tools/Circles.html

30 lines
912 B
HTML
Raw Normal View History

2011-02-21 08:31:26 -05:00
<!DOCTYPE html>
2011-02-08 07:16:43 -05:00
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
2011-03-07 20:07:26 -05:00
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
2011-03-04 06:38:38 -05:00
<script type="text/paperscript" canvas="canvas">
2011-04-23 10:30:29 -04:00
// All newly created items will receive
// these style properties:
project.currentStyle = {
2011-04-23 10:30:29 -04:00
fillColor: 'white',
strokeColor: 'black'
};
var path;
2011-03-04 06:38:38 -05:00
function onMouseDrag(event) {
2011-04-23 10:30:29 -04:00
// The radius is the distance between the position
// where the user clicked and the current position
// of the mouse.
var radius = (event.downPoint - event.point).length;
path = new Path.Circle(event.downPoint, radius);
2011-05-06 10:51:26 -04:00
path.removeOnDrag();
2011-03-04 06:38:38 -05:00
};
2011-02-08 07:16:43 -05:00
</script>
</head>
<body>
<canvas id="canvas" resize keepalive="true"></canvas>
2011-02-08 07:16:43 -05:00
</body>