参考 instanceID()

instanceID()

此 API 是实验性的

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

警告

Use instanceIndex instead.

A function alias for instanceIndex, kept for compatibility. Prefer using instanceIndex directly as a value instead.

Returns the index of the current instance when drawing multiple copies of a shape with model(count).

instanceID() can only be used inside a p5.strands shader callback.

示例

语法

instanceID()

参数

返回值

The index of the current instance.

相关参考