paper.js how to set up multiple canvases using only javascript

后端 未结 6 812
予麋鹿
予麋鹿 2021-02-13 21:31

I\'m trying to use paper.js in a webapp, but I\'ve been unable to get it to work with multiple canvases. It\'s like the scopes are getting mixed up between the canvases, so when

6条回答
  •  难免孤独
    2021-02-13 22:30

    I actually solve this a bit differently:

    var scope1 = new paper.PaperScope();
    var scope2 = new paper.PaperScope();
    

    When I want to draw in scope1:

    scope1.activate();
    // now I draw
    

    Similarly when I want to draw in scope 2

    scope2.activate();
    // now I draw
    

提交回复
热议问题