I hope not pose an already answered question, but I could not find something helpful anywhere. I am evaluating javascript libraries for 2d vector graphics and animation. On my way i found paper.js but no way to use it with type="text/javascript", without canvas and so on. In the paper.js FAQ about this point here i could find out that it might work, but for now i could not get it to work.
If anybody has any experience with this, it would be nice to let me know about this.
I hope not pose an already answered question, but I could not find something helpful anywhere. I am evaluating javascript libraries for 2d vector graphics and animation. On my way i found paper.js but no way to use it with type="text/javascript", without canvas and so on. In the paper.js FAQ about this point here i could find out that it might work, but for now i could not get it to work.
If anybody has any experience with this, it would be nice to let me know about this.
Share Improve this question edited Nov 2, 2011 at 1:02 Dave Lee 5086 silver badges17 bronze badges asked Jul 18, 2011 at 11:43 philippphilipp 16.5k15 gold badges65 silver badges118 bronze badges 1- after some time of looking around i found annoying solution. Adding a new Script-Tag to head, just before the document is loaded. This script-tag needs to have a type of text/paperscript. Then it runs, but no debugging with firebug and so on. This is an mess! So if anybody got an idea, this would be great!! – philipp Commented Jul 18, 2011 at 13:03
2 Answers
Reset to default 5Since version 0.2, using paper.js from pure JavaScript is easy and well documented. One way to initialize is:
var scope = new paper.PaperScope();
scope.setup(myCanvas);
Full documentation here: http://paperjs/tutorials/getting-started/using-javascript-directly/
I'm not sure what you mean by "without canvas" though, paper.js does need a canvas object to operate.
You can as of 0.11.4 (and perhaps before) create a canvas-less project in the same way as the accepted answer. More here.
paper.setup(); // creates a new project
paper.setup([width, height]); // this also works for some width, height
// whatever vector calculations you now want to do.