scrawl-canvas
Version:
Version 8.9.4 - 19 Nov 2022
74 lines (60 loc) • 2.15 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 Delaunator 002</title>
<link href="css/normalize.css" rel="stylesheet" />
<link href="css/tests.css" rel="stylesheet" />
<style>
#my-image-store {
display: none;
}
.canvas-container {
overflow: hidden;
resize: both;
border: 1px solid black;
width: 400px;
height: 400px;
min-height: 200px;
min-width: 200px;
max-height: 600px;
max-width: 600px;
}
</style>
</head>
<body>
<h1><a href="index.html">Scrawl-canvas v8</a> - Delaunator test 002</h1>
<h2>Responsive Voronoi cells in a RawAsset wrapper</h2>
<h3>Drag the bottom right corner of the canvas to resize it<br />To change image, drag-and-drop an image file over the canvas</h3>
<div class="canvas-container">
<canvas
id="mycanvas"
data-scrawl-canvas
data-is-responsive="true"
data-base-width="400"
data-base-height="400"
data-fit="cover"
data-base-background-color="black"
></canvas>
</div>
<p id="reportmessage"></p>
<div class="testinfo">
<h4>Test purpose</h4>
<ul>
<li>Check that we can load the <a href="https://github.com/mapbox/delaunator">Delaunator JS library</a> into a module from a remote CMS.</li>
<li>Use a set of static coordinates, alongside the mouse cursor, as the source points for the Delaunay triangulation calculations.</li>
<li>Use the calculated Voronoi edges to create a mosaic scene to an image</li>
<li>Give the scene a 3d effect using a filter</li>
<li>Animate the scene, updating the Voronoi edges as the user moves the mouse cursor over the canvas.</li>
</ul>
<p><b>Touch test:</b> canvas should be resizable</p>
<p><a href="../docs/demo/delaunator-002.html">Annotated code</a></p>
</div>
<div id="my-image-store">
<img id="iris" src="img/iris.png" class="flowers" />
</div>
<script src="delaunator-002.js" type="module"></script>
</body>
</html>