diff --git a/README.md b/README.md index ad56fe3..6d17f9b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Phenomenon is a very small, low-level WebGL library that provides the essentials - Low-level & highly configurable - Helper functions with options - Add & destroy instances dynamically +- Dynamic attribute switching *Want to see some magic right away? Have a look here!* @@ -141,6 +142,14 @@ Remove an instance from the scene (and from memory) by its key. Remove all instances and the renderer itself. The canvas element will remain in the DOM. +### .prepareAttribute(attribute) + +Dynamically override an attribute with the same logic that is used during initial creation of the instance. The function requires an object with a name, size and data attribute. + +> Note: The calculation of the data function is done on the CPU. Be sure to check for dropped frames with a lot of particles. + +Attributes can also be switched. In the demo this is used to continue with a new start position identical to the end position. This can be achieved with `.prepareBuffer(attribute)` in which the data function is replaced with the final array. + ## Examples 1. Particles diff --git a/package.json b/package.json index 59b6ad0..70ce3b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phenomenon", - "version": "1.3.1", + "version": "1.4.0", "description": "A fast 2kB low-level WebGL API.", "main": "dist/phenomenon.mjs", "unpkg": "dist/phenomenon.umd.js",