push()

This feature requires the p5.webgpu.js addon.
이 API는 실험적입니다

향후 p5.js 버전에서 동작이 변경될 수 있습니다.

Appends one element to the list. This can be called from your sketch's JavaScript or from within a compute shader. Use this to seed a list before any compute shaders run. Calling push() after a GPU compute pass that has already modified the list will produce undefined ordering.

For a float list, pass a number. For a struct list, pass a plain object whose properties match the schema.

You can also use push() from compute shaders. This approach can often be faster as no data needs to transfer from the CPU to the GPU.

예제

구문

push(element)

매개변수

element
Number|Object: A number for float lists, or a plain object matching the list's schema for struct lists.

관련 레퍼런스