Test purpose
- Create a particle world object; add a user-defined attribute ('wind') to it.
- Create a wind Force, and a 'changeWind' function that updates the World.wind attribute at the start of each Display cycle.
- Create a Net entity; set the 'columnDistance' attribute to a % String to make sure it will correctly convert it to a pixel distance. Set the 'generate' attribute to 'weak-net'; the 'forces' attribute to ['gravity', 'wind']; etc.
- Include a 'postGenerate' function that will identify three specific particles, change their 'fill' and 'stroke' attributes to new colors, and go through the Scrawl-canvas scrawl.library.spring section to set the 'particleFromIsStatic' flag of all Spring objects associated with these Particles to true.
- Confirm that the Net entity generates a mesh of particles, with three particles in the leftmost column displaying a different color, and not moving.
- Check that particles respond to the gravity and wind forces appropriately (we are looking for a flapping sheet animation).
- Check the effect of changing the Net attributes 'mass', 'springConstant', 'damperConstant' and 'restLength'.
- Check the effect of changing the Net's 'engine' attribute - note that simulation failure is expected under various conditions (and is not a test failure).
- Check the effect of changing the Net's 'generate' attribute
- Navigate away from the web page (open another tab in the browser) and, a few seconds later, navigate back to the page - check that the animation resets and starts, and does not freeze the page
Note: The Safari browser is particularly sensitive to attempts to display images on Net entitys (using the Mesh entity) - the Demo most often works for this scenario when the tick multiplier attribute is reduced.
Annotated code