using paper.js without canvas and paperscript
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 fou开发者_如何学Gond 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.
Since 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.org/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.
精彩评论