React / Webpack 中的 p5 image() 友好错误消息
p5 image() friendly error message in React / Webpack
我正在重构 p5 草图作为 React/Redux 构建的一部分,并且从 p5 收到以下关于传递给 p.image() function (note: I am using p5 in instance mode 的参数的友好错误消息。
p5.js says: image() was expecting p5.Image|p5.Element for parameter #0 (zero-based index), received p5.Element instead at webpack-internal:///239:103:9. [http://p5js.org/reference/#p5/image]
消息似乎指的是视频参数,是从 p.createCapture( p.VIDEO )
返回的 p5.MediaElement
- 即网络摄像头流。在静态上下文中使用相同的函数调用时,我没有遇到任何问题。
p.image 调用位于以下代码块中:
const noiseX = p.noise(xoff)*(canvWidth+vWidth);
const noiseY = p.noise(yoff)*(canvHeight+vHeight);
xoff+=visualSettings.perlinScale.active;
yoff+=visualSettings.perlinScale.active;
p.image(video, noiseX-vWidth, noiseY-vHeight, vWidth, vHeight);
草图仍然按预期运行,但我想适当地解决问题(此外,错误位于绘制周期内,这真的很烦人)。
尚不清楚解决该问题需要什么,因为友好的错误消息说它是 'expecting a p5.Image or p5.Element' 并且有 'received p5.Element instead'。任何人都可以提供任何澄清,我们将不胜感激。
此处的问题与 p5 0.6.0 中的错误有关。将在即将发布的 p5 版本中 fixed。
同时,可以通过设置 p5.disableFriendlyErrors = true;
或使用 p5 的缩小版本(默认隐藏友好错误消息)来隐藏错误消息。
特别感谢 GoToLoop 通过 Processing 论坛提供的帮助 discussion。
我正在重构 p5 草图作为 React/Redux 构建的一部分,并且从 p5 收到以下关于传递给 p.image() function (note: I am using p5 in instance mode 的参数的友好错误消息。
p5.js says: image() was expecting p5.Image|p5.Element for parameter #0 (zero-based index), received p5.Element instead at webpack-internal:///239:103:9. [http://p5js.org/reference/#p5/image]
消息似乎指的是视频参数,是从 p.createCapture( p.VIDEO )
返回的 p5.MediaElement
- 即网络摄像头流。在静态上下文中使用相同的函数调用时,我没有遇到任何问题。
p.image 调用位于以下代码块中:
const noiseX = p.noise(xoff)*(canvWidth+vWidth);
const noiseY = p.noise(yoff)*(canvHeight+vHeight);
xoff+=visualSettings.perlinScale.active;
yoff+=visualSettings.perlinScale.active;
p.image(video, noiseX-vWidth, noiseY-vHeight, vWidth, vHeight);
草图仍然按预期运行,但我想适当地解决问题(此外,错误位于绘制周期内,这真的很烦人)。
尚不清楚解决该问题需要什么,因为友好的错误消息说它是 'expecting a p5.Image or p5.Element' 并且有 'received p5.Element instead'。任何人都可以提供任何澄清,我们将不胜感激。
此处的问题与 p5 0.6.0 中的错误有关。将在即将发布的 p5 版本中 fixed。
同时,可以通过设置 p5.disableFriendlyErrors = true;
或使用 p5 的缩小版本(默认隐藏友好错误消息)来隐藏错误消息。
特别感谢 GoToLoop 通过 Processing 论坛提供的帮助 discussion。