Paper.js vector operation

前端 未结 1 1460
忘掉有多难
忘掉有多难 2020-12-19 10:45

I\'m new to paper.js and ran into some troubles.



        
相关标签:
1条回答
  • 2020-12-19 11:47

    Paper.js operator overloading for vector operations only works when you include the library with type="text/paperscript". Otherwise you have to use: add, subtract, multiply, divide, modulo, equals for +, -, *, /, % and ==.

    like so:

    point1.add([ 200, -50 ]);
    

    or for your example:

    radius: event.downPoint.subtract(event.point).length,
    

    Here is your example with subtract and here are some more examples and tests.

    0 讨论(0)
提交回复
热议问题