Reference instanceID()

instanceID()

This API is experimental

Its behavior may change in a future version of p5.js.

Warning

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.

Examples

Syntax

instanceID()

Parameters

Returns

The index of the current instance.
Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!

Related References