paperjs

Paper.js external file will not load

允我心安 提交于 2019-12-01 20:54:16
I am just trying to get into paper.js. Code works fine when they're inlined. But when I move them to an external file and src it there, errors starts to pop up :( Can anyone figure out what I did wrong? Error screenshot is attached Much thanks! Error screenshot <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Paper.js Test</title> <script type="text/javascript" src="bower_components/paper/dist/paper-full.min.js"></script> <script type="text/paperscript" src="test.js" canvas="myCanvas"></script> </head> <body> <canvas id="myCanvas" resize="true"></canvas> </body> </html> From your

Transform bounding box in Paper.js

不羁岁月 提交于 2019-11-30 09:23:31
问题 I am trying to implement a transform bounding box in Paper.js, but it is not working properly yet. Here is my code. As you can see, the path and the selection box do not seem to rotate around the same pivot, and both path get desynchronized after a while. Any idea why this happens? I though about having both paths in a group, and transforming the group instead, but I had no time to try this yet. What is the best way to implement this? 回答1: Every object's pivot point is at its bounds.center

Paper.js vector operation

北城余情 提交于 2019-11-29 10:57:43
I'm new to paper.js and ran into some troubles. <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> In this code the (event.downPoint - event.point).length works well but i want to use javascript directly so i did: <script type=

HTML5 Canvas redraw-cycle performance optimisations

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 17:18:44
We are building a CAD app that runs in a browser. C.A.D stands for Computer Aided Design . Illustrator, CorelDraw, AutoCAD etc are some examples of CAD apps. It's based on Paper.js , a very neat Canvas library that allows you to manipulate vectors programmatically. The problem The major issue I am having at the moment is redraw cycle performance. The redraw algorithm is 'dumb' (in terms of clever hacks to improve performance) and thus inefficient and slow - Rendering the Scene Graph items is dependent on a progressively slower redraw-cycle. As points-to-draw accumulate, each redraw cycle

Paper.js vector operation

守給你的承諾、 提交于 2019-11-28 04:24:57
问题 I'm new to paper.js and ran into some troubles. <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> In this code the (event

HTML5 Canvas redraw-cycle performance optimisations

孤人 提交于 2019-11-27 20:09:14
问题 We are building a CAD app that runs in a browser. C.A.D stands for Computer Aided Design. Illustrator, CorelDraw, AutoCAD etc are some examples of CAD apps. It's based on Paper.js, a very neat Canvas library that allows you to manipulate vectors programmatically. The problem The major issue I am having at the moment is redraw cycle performance. The redraw algorithm is 'dumb' (in terms of clever hacks to improve performance) and thus inefficient and slow - Rendering the Scene Graph items is