小编Ada*_*szt的帖子

Paper.js矢量操作

我是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)

javascript html5 canvas vector paperjs

5
推荐指数
1
解决办法
2450
查看次数

标签 统计

canvas ×1

html5 ×1

javascript ×1

paperjs ×1

vector ×1