paper.js/examples/Tools/Circles.html
2014-08-16 19:24:54 +02:00

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>