javascript - Paperjs 用数组除法?

标签 javascript type-conversion paperjs

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/

相关文章:

java - java 6 中的二进制值

javascript - 带有 webpack 的 Paper.js

javascript - Paper.js CompoundPath 未在 Canvas 上打印任何内容

javascript - PHP 在 Jquery UI 自动完成中显示数组

javascript - 单击汉堡包图标然后调整浏览器大小后导航栏元素消失

c - atoi() 是 C 标准的一部分吗?

javascript - 将 paper.js 路径转换为 ​​opentype.js 路径

javascript - 省略 prototype.constructor 会改变原型(prototype)链

javascript - Angular 1.x 在指令模板体内消耗外部作用域

arrays - 为什么不能在 Go 中将 [Size]byte 转换为字符串?