gpt4 book ai didi

javascript - Paperjs 用数组除法?

转载 作者:行者123 更新时间:2023-11-28 08:43:36 28 4
gpt4 key购买 nike

http://paperjs.org/examples/chain/在源代码第 16 行你可以看到:

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

我假设这是某种二维向量除法。但是如何才能在 javascript 中定义某些操作的类型转换呢?
或者这个字符串是否被解析并翻译成其他一些 JavaScript 代码?

最佳答案

引自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.

关于javascript - Paperjs 用数组除法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20173081/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com