我是paper.js的新手,遇到了一些麻烦.
<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>
Run Code Online (Sandbox Code Playgroud)
在这段代码中(event.downPoint - event.point).length运行良好,但我想直接使用javascript,所以我做了:
<script type="text/javascript">
paper.install(window);
// Keep global references to both tools, so the HTML
// links below can access them.
var …Run Code Online (Sandbox Code Playgroud)