paperjs

issue with paperjs rotate

狂风中的少年 提交于 2019-12-13 02:49:35
问题 Using paperjs if I rotate p.view.rotate(update.deg); it is working fine with out issue. If I refresh the page and call the above function p.view.rotate(update.deg); onload then the view is different. it is displaying a slight zoom. default image rotation After reloading the page I am rotating p.view with the previous value. then it is displaying as Here is my js file https://github.com/muralibobby35/annotateJs/blob/master/opentok-whiteboardnew.js 回答1: I was not able to run your code but I

Draw line with arrow cap

巧了我就是萌 提交于 2019-12-12 20:12:17
问题 I am trying to draw a line with arrow at the tip of the line. But i am unable to complete it. Can any one help me. I tried adding triangle with line but unfortunately it wont work while dynamically drawing. This is what i tried along with line. var myPath; function onMouseDown(event) { myPath = new Path(); myPath.strokeColor = 'black'; } function onMouseDrag(event) { myPath.add(event.point); } function onMouseUp(event) { var myCircle = new Path.RegularPolygon(event.point, 3, 10); myCircle

Paper.js Z-Index and Binding Object

痞子三分冷 提交于 2019-12-12 04:36:50
问题 I am studing paper.js and don´t found how resolve my problem. See my application test in: http://www.plugbox.com.br/reta.htm The red circle covers only the Y axis and blue circle covers only the X axis and the starting point and the end point of the line follow the red and blue points. But the line is in front of circles. How do I set the "z-index" line by placing it in a layer behind the points? Another question is: How do I put a third point, for example, in the middle of the line and make

Visual Studio Code: Paperscript

爱⌒轻易说出口 提交于 2019-12-12 04:15:43
问题 (sorry for my english skills) Did you know any ext or something to color paperscript code? paperscript off colors example 回答1: Because your editor doesn't recognise the text/paperscript MIMEtype, it doesn't know what syntax highlighting to apply to it. To circumvent this, your best bet is to store your paperscript code in a separate file with the .js extension. Then your editor will automatically apply the correct JS syntax highlighting to it. index.html <script type="text/paperscript" canvas

Resize the width and height of shape (not scaling) in paperjs

▼魔方 西西 提交于 2019-12-12 03:37:52
问题 How can I implement the resizing of width and height of a shape in paper js. just like this : Resizing Objects in Fabric.js ? I am currently basing on this link : Transform bounding box in Paper.js . 回答1: I have implemented it in Romanesco but it is a bit complicated (I still have to clean the code). Maybe you would go faster by doing it yourself. Anyway you can have a look in the source code, in SelectionRectangle.coffee, SelectTool.coffe and Item.coffee. 来源: https://stackoverflow.com

how to use paperjs on dynamically created canvas?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 23:49:50
问题 I have multiple canvas images on my page I am trying to get canvas id using paperjs after mousedown event on a single image through jquery. My image disappears after a mouse click and after running the below code... <script type="text/javascript"> window.onload = function () { $('#imgID').on('mousedown', function (e) { //imgID is my div if($.isNumeric(e.target.id)){ console.log(e.target.id); var canvas = document.getElementById(e.target.id); paper.setup(canvas); var path = new paper.Path

Paper.js - convert `paperscript` to `javascript`

狂风中的少年 提交于 2019-12-11 19:26:49
问题 I am trying to change this paperscript : <script type="text/paperscript" canvas="canvas-1"> tool.minDistance = 10; tool.maxDistance = 45; var path; function onMouseDown(event) { path = new Path(); path.fillColor = new Color({ hue: Math.random() * 360, saturation: 1, brightness: 1 }); path.add(event.point); } function onMouseDrag(event) { var step = event.delta / 2; step.angle += 90; var top = event.middlePoint + step; var bottom = event.middlePoint - step; path.add(top); path.insert(0, bottom

In Paper.js, is there a simple way to select the closest point (relative to mouse)?

我们两清 提交于 2019-12-11 12:42:35
问题 I wish to interactively move handles or points in a path with the mouse. I think I can manage to program a scan in all points and handles and compute the one at mouse position. But is there a more simple way to select them? 回答1: You can use getNearestPoint(cursorPoint) method which can be invoked from Path item Link to the documentation with an example: http://paperjs.org/reference/path/#getnearestpoint-point 来源: https://stackoverflow.com/questions/31227091/in-paper-js-is-there-a-simple-way

PaperJS SymbolItems lose properties after hit result search

点点圈 提交于 2019-12-11 05:12:50
问题 I'm creating a SymbolDefinition for a circle, and placing it on the canvas using new SymbolItem(definition) . The circle object used to create the definition had a default position of (0,0), a default color, and no additional information because whatever defaults paper sets. When I instance the symbol and place it at a certain position (lets say (20,30) for example), I also append some other information such as a name, some supplementary info in its data property, etc. If I click on the

Use PaperJS export path with Hummus PDF JS

◇◆丶佛笑我妖孽 提交于 2019-12-11 04:29:08
问题 I am trying to draw paths with Hummus PDF JS based on paths exported from PaperJS. Hence PaperJS data output would be the data input for Hummus. Those two libraries works differently to create curves. PaperJS uses handles to curve a straight lines, while Hummus will curve a line based on 3 points. Let's say I want to have a curved line that goes through 3 key points: [200, 100] -> [300, 200] -> [400, 100]. Like this picture: With PaperJS, I will have to do something like this: var vector =