参考 getTexture()

getTexture()

此 API 是实验性的

其行为可能在 p5.js 的未来版本中发生变化。

示例

语法

getTexture(texture, coords)

参数

texture
The texture to sample from. (e.g. a p5.Image, p5.Graphics, or p5.Framebuffer).
coords
The 2D coordinates to sample from. This should be between [0,0] (the top-left) and [1,1] (the bottom-right) of the texture. It should be compatible with a vec2.

返回值

The color of the given texture at the given coordinates. This will behave as a vec4 holding components r, g, b, and a (alpha), with each component being in the range 0.0 to 1.0.
Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!

相关参考