scrawl-canvas
Version:
Version 8.9.4 - 19 Nov 2022
159 lines (133 loc) • 6.53 kB
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 Canvas 024</title>
<link href="css/normalize.css" rel="stylesheet" />
<link href="css/tests.css" rel="stylesheet" />
<style>
.controls {
grid-template-columns: 1fr 2fr 2fr 1fr 2fr 2fr;
}
canvas {
margin: 0 auto;
}
#my-image-store {
display: none;
}
</style>
</head>
<body>
<h1><a href="index.html">Scrawl-canvas v8</a> - Canvas test 024</h1>
<h2>Loom entity functionality</h2>
<h3>To change image, drag-and-drop an image file over the canvas then update one of the controls</h3>
<canvas
id="mycanvas"
width="600"
height="600"
data-scrawl-canvas
data-base-background-color="aliceblue"
></canvas>
<p id="reportmessage"></p>
<div class="controls">
<div class="blue label">From path</div>
<div class="blue">start <input class="controlItem" id="fromStart" type="range" value="0" min="0" max="1" step="0.01" /></div>
<div class="blue">end <input class="controlItem" id="fromEnd" type="range" value="1" min="0" max="1" step="0.01" /></div>
<div class="blue label">To path</div>
<div class="blue">start <input class="controlItem" id="toStart" type="range" value="0" min="0" max="1" step="0.01" /></div>
<div class="blue">end <input class="controlItem" id="toEnd" type="range" value="1" min="0" max="1" step="0.01" /></div>
<div class="green label">Sync path cursors</div>
<div class="green">
<select class="controlItem" id="sync">
<option value="0">False</option>
<option value="1">True</option>
</select>
</div>
<div class="green"> </div>
<div class="green label">Rendering</div>
<div class="green">
<select class="controlItem" id="rendering">
<option value="1">Horizontal</option>
<option value="0">Vertical</option>
</select>
</div>
<div class="green"> </div>
<div class="green label">Path cursor loop</div>
<div class="green">
<select class="controlItem" id="looping">
<option value="0">False</option>
<option value="1">True</option>
</select>
</div>
<div class="green"> </div>
<div class="green label">Animation</div>
<div class="green">
<select class="controlItem" id="animation">
<option value="off">Off</option>
<option value="posDelta">+ve Delta</option>
<option value="negDelta">-ve Delta</option>
</select>
</div>
<div class="green"> </div>
<div class="yellow label">Select filter</div>
<div class="yellow">
<select class="controlItem" id="filter">
<option value="">none</option>
<option value="cyan">cyan</option>
<option value="grayscale">grayscale</option>
<option value="pixelate">pixelate</option>
<option value="sepia">sepia</option>
</select>
</div>
<div class="yellow"> </div>
<div class="yellow label">Select method</div>
<div class="yellow">
<select class="controlItem" id="method">
<option value="fill">Fill</option>
<option value="draw">Draw</option>
<option value="fillAndDraw">Fill and draw</option>
<option value="drawAndFill">Draw and fill</option>
<option value="fillThenDraw">Fill then draw</option>
<option value="drawThenFill">Draw then fill</option>
<option value="clear">Clear</option>
</select>
</div>
<div class="yellow"> </div>
<div class="pink label">Copy Starts ('n%')</div>
<div class="pink">X: <input class="controlItem" id="copy_start_xPercent" type="range" value="0" min="-5" max="105" step="1" /></div>
<div class="pink">Y: <input class="controlItem" id="copy_start_yPercent" type="range" value="0" min="-5" max="105" step="1" /></div>
<div class="lavender label">Copy Width</div>
<div class="lavender">'n%' <input class="controlItem" id="copy_dims_widthPercent" type="range" value="100" min="0" max="105" step="1" /></div>
<div class="lavender">n <input class="controlItem" id="copy_dims_widthAbsolute" type="range" value="400" min="0" max="405" step="1" /></div>
<div class="pink label">Copy Starts (n)</div>
<div class="pink">X: <input class="controlItem" id="copy_start_xAbsolute" type="range" value="0" min="-5" max="405" step="1" /></div>
<div class="pink">Y: <input class="controlItem" id="copy_start_yAbsolute" type="range" value="0" min="-5" max="405" step="1" /></div>
<div class="lavender label">Copy Height</div>
<div class="lavender">'n%' <input class="controlItem" id="copy_dims_heightPercent" type="range" value="100" min="0" max="105" step="1" /></div>
<div class="lavender">n <input class="controlItem" id="copy_dims_heightAbsolute" type="range" value="400" min="0" max="405" step="1" /></div>
</div>
<div class="testinfo">
<h4>Test purpose</h4>
<ul>
<li>Create a Loom entity, using quadratic and bezier curve Shape entitys as its frame's struts</li>
<li>Display an image taken from Picture entity between the Loom entity frame's struts</li>
<li>Distort the frame using Wheel entitys acting as pivots for the Shape entitys' start, end and control points</li>
<li>Create controls for each frame's start and end points; manipulate the display using these controls</li>
<li>Create a control to switch between horizontal and vertical rendering of the image</li>
<li>Create a control to animate the image display along the frame (delta animation)</li>
<li>Create a control to test animation looping functionality</li>
<li>Create a control to swap between entity rendering methods</li>
<li>Create a control to apply filters to the Picture entity; check that the Loom entity responds immediately to any updates</li>
<li>Create controls for the Picture entity's copy start and dimensions values; check that the Loom entity responds immediately to any updates</li>
</ul>
<p><b>Touch test:</b> should work as expected. Known issue: moving the pins is inconsistent (because pins are too small on device screens?)</p>
<p><a href="../docs/demo/canvas-024.html">Annotated code</a></p>
</div>
<div id="my-image-store">
<img id="iris" src="img/iris.png" class="flowers" />
</div>
<script src="canvas-024.js" type="module"></script>
</body>
</html>