参数 'p' 在 sketch-rnn p5.js 代码的函数中是什么意思?
What does the parameter 'p' mean in a function of the sketch-rnn p5.js code?
我没有在 repo 中看到任何定义 p 变量的代码,所以我不确定那是什么意思。为什么函数需要参数'p',它是什么意思?
代码的抽象结构如下所示:
const sketch = function(p) {
...
p.setup = function(){...}
p.mousePressed = function () {...}
p.mouseReleased = function () {...}
p.mouseDragged = function () {...}
p.draw = function() {...}
...
}
...
new p5(sketch, 'sketch');
p
是调用sketch函数时传入的变量。
我没有在 repo 中看到任何定义 p 变量的代码,所以我不确定那是什么意思。为什么函数需要参数'p',它是什么意思?
代码的抽象结构如下所示:
const sketch = function(p) {
...
p.setup = function(){...}
p.mousePressed = function () {...}
p.mouseReleased = function () {...}
p.mouseDragged = function () {...}
p.draw = function() {...}
...
}
...
new p5(sketch, 'sketch');
p
是调用sketch函数时传入的变量。