mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
30 lines
No EOL
844 B
HTML
30 lines
No EOL
844 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>Example</title>
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
<script type="text/javascript" src="../../dist/paper.js"></script>
|
|
<script type="text/paperscript" canvas="canvas">
|
|
// All newly created items will receive
|
|
// these style properties:
|
|
project.currentStyle = {
|
|
fillColor: 'white',
|
|
strokeColor: 'black'
|
|
};
|
|
|
|
var path;
|
|
function onMouseDrag(event) {
|
|
// 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);
|
|
path.removeOnDrag();
|
|
};
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvas" resize></canvas>
|
|
</body>
|
|
</html> |