문제

In http://paperjs.org/examples/chain/ at source code line 16 you can see this:

var start = view.center / [10, 1];

I assume that this is some kind of 2D vector division. But how can someone define the type conversions at certain operations in javascript?
Or is this string parsed and translated into some other javascript code?

도움이 되었습니까?

해결책

Quoting from the Paper.js Website:

What is PaperScript?

PaperScript is the plain old JavaScript that you are used to, with added support of mathematical operators (+ - * / %) for Point and Size objects. PaperScript code is automatically executed in its own scope that without polluting with the global scope still has access to all the global browser objects and functions, such as document or window.

By default, the Paper.js library only exports one object into the global scope: the paper object. It contains all the classes and objects that the library defines. When working with PaperScript, the user does not need to care about this though, because inside PaperScript code, through the use of clever scoping, all of paper's objects and functions seem global.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top