mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-28 17:02:24 -05:00
28 lines
932 B
HTML
28 lines
932 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Circles</title>
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
<script type="text/paperscript" canvas="canvas">
|
|
function onMouseDrag(event) {
|
|
// The radius is the distance between the position
|
|
// where the user clicked and the current position
|
|
// of the mouse.
|
|
var path = new Path.Circle({
|
|
center: event.downPoint,
|
|
radius: (event.downPoint - event.point).length,
|
|
fillColor: 'white',
|
|
strokeColor: 'black'
|
|
});
|
|
|
|
// Remove this path on the next drag event:
|
|
path.removeOnDrag();
|
|
};
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvas" resize></canvas>
|
|
</body>
|
|
</html>
|