UNPKG

scrawl-canvas

Version:
115 lines (87 loc) 5.12 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Demo Particles 001</title> <link href="css/normalize.css" rel="stylesheet" /> <link href="css/tests.css" rel="stylesheet" /> <style> .controls { grid-template-columns: 1fr 2fr 1fr 2fr; } canvas { margin: 0 auto; } </style> </head> <body> <h1><a href="index.html">Scrawl-canvas v8</a> - Particles test 001</h1> <h2>Emitter entity, and Particle World, basic functionality</h2> <div class="controls"> <div class="green label">World speed</div> <div class="green"><input class="controlItem" id="world-speed" type="range" value="2" min="0.5" max="4" step="0.01" /></div> <div class="green label">World alpha decay</div> <div class="green"><input class="controlItem" id="color-alpha" type="range" value="6" min="1" max="10" step="0.1" /></div> <div class="green label">Maximum color</div> <div class="green"><input class="controlItem" id="maxcolor-controller" type="color" value="#f0f8ff" /></div> <div class="green label">Minimum color</div> <div class="green"><input class="controlItem" id="mincolor-controller" type="color" value="#f0f8ff" /></div> <div class="green label">Background color</div> <div class="green"><input class="controlItem" id="background" type="color" value="#000040" /></div> <div class="pink label">Include gravity</div> <div class="pink"> <select class="controlItem" id="gravity"> <option value="no">false</option> <option value="yes">true</option> </select> </div> <div class="blue label">Generation rate (per sec)</div> <div class="blue"><input class="controlItem" id="generationRate" type="range" value="60" min="0" max="200" step="1" /></div> <div class="blue label">History length</div> <div class="blue"><input class="controlItem" id="historyLength" type="range" value="100" min="1" max="200" step="1" /></div> <div class="lavender label">Lifespan (secs)</div> <div class="lavender"><input class="controlItem" id="killAfterTime" type="range" value="5" min="0" max="10" step="0.1" /></div> <div class="lavender label">Life variation (secs)</div> <div class="lavender"><input class="controlItem" id="killAfterTimeVariation" type="range" value="0.1" min="0" max="5" step="0.1" /></div> <div class="yellow label">Range - x</div> <div class="yellow"><input class="controlItem" id="range_x" type="range" value="40" min="-80" max="80" step="1" /></div> <div class="yellow label">Range from - x</div> <div class="yellow"><input class="controlItem" id="rangefrom_x" type="range" value="-20" min="-80" max="80" step="1" /></div> <div class="yellow label">Range - y</div> <div class="yellow"><input class="controlItem" id="range_y" type="range" value="40" min="-80" max="80" step="1" /></div> <div class="yellow label">Range from - y</div> <div class="yellow"><input class="controlItem" id="rangefrom_y" type="range" value="-20" min="-80" max="80" step="1" /></div> <div class="yellow label">Range - z</div> <div class="yellow"><input class="controlItem" id="range_z" type="range" value="-1" min="-2" max="2" step="0.1" /></div> <div class="yellow label">Range from - z</div> <div class="yellow"><input class="controlItem" id="rangefrom_z" type="range" value="-0.2" min="-2" max="2" step="0.1" /></div> </div> <canvas id="mycanvas" width="600" height="400" data-scrawl-canvas ></canvas> <p id="reportmessage"></p> <div class="testinfo"> <h4>Test purpose</h4> <ul> <li>Create a particle world object</li> <li>Add user-defined attributes to the particle world object - check that appropriate messages print </li> <li>Create a particle Emitter entity</li> <li>Check to see that the Emitter entity can lock to the mouse cursor</li> <li>Check that particles respond to the gravity force, when applied (include gravity)</li> <li>Check the effect of changing the world object's tickMultiplier (world speed) attribute</li> <li>Change the maximum and minimum colors; check that the changes are reflected in the particle's colors (testing the Color range functionality)</li> <li>Check the effects of changing the following emitter/particle attributes: historyLength; generationRate; killAfterTime; killAfterTimeVariation; lifespan; life variation; range (x, y, z); rangeFrom (x, y, z)</li> <li>Check that the canvas backgroundColor attribute can be updated (background color)</li> <li>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</li> </ul> <p><b>Touch test:</b> should work as expected</p> <p><a href="../docs/demo/particles-001.html">Annotated code</a></p> </div> <script src="particles-001.js" type="module"></script> </body> </html>