making it work as a reference while making a real tiling
I've gathered the vector and matrix functions in Point and Matrix classes. Going to make the building functions part of a builder class. You can drag to pan the view. Clicking a tile highlights it. Each tile is labelled with a number, but it gets reflected when there's an odd number of iterations - need to fix that.
This commit is contained in:
parent
c34514e939
commit
bdf1890ac0
2 changed files with 276 additions and 353 deletions
67
index.html
67
index.html
|
@ -1,28 +1,44 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Aperiodic monotile</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<script src="script.js" defer></script>
|
||||
<script src="script.js?t=202505071454" defer></script>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
svg {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid black;
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
body {
|
||||
overscroll-behavior: contain;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: grid;
|
||||
height: 100svh;
|
||||
grid-template:
|
||||
"drawing" 50vh
|
||||
"controls" 1fr
|
||||
"drawing" 80svh
|
||||
"controls" min-content
|
||||
/ 1fr;
|
||||
}
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 20em;
|
||||
}
|
||||
|
||||
.tile {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.tile.highlight {
|
||||
color: hsl(240,100%,80%);
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -30,7 +46,7 @@ textarea {
|
|||
<svg viewBox="0 0 190 195" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<path id="spectre"
|
||||
d="M 0 1 C 0.6 0.6699999999999999 0.6 0.32999999999999996 0 0 C 0.33 -0.6 0.67 -0.6 1 0 C 1.684615242270663 0.014211616751135248 1.854615242270663 -0.2802370205355739 1.5 -0.8660254037844386 C 2.0857883832488646 -1.2206406460551018 2.380237020535574 -1.0506406460551019 2.366025403784439 -0.36602540378443865 C 1.7660254037844387 -0.03602540378443864 1.7660254037844387 0.3039745962155614 2.366025403784439 0.6339745962155614 C 2.696025403784439 0.033974596215561426 3.0360254037844387 0.033974596215561426 3.366025403784439 0.6339745962155614 C 3.011410161513776 1.2197629794644262 3.1814101615137758 1.5142116167511352 3.866025403784439 1.5 C 3.880237020535574 2.184615242270663 3.5857883832488646 2.354615242270663 3 2 C 3.014211616751135 1.3153847577293367 2.719762979464426 1.1453847577293368 2.133974596215561 1.5 C 2.4885898384862246 2.085788383248865 2.3185898384862247 2.3802370205355743 1.6339745962155614 2.3660254037844393 C 1.3039745962155613 1.7660254037844392 0.9639745962155614 1.7660254037844392 0.6339745962155614 2.3660254037844393 C 0.3039745962155614 2.9660254037844394 -0.03602540378443864 2.9660254037844394 -0.3660254037844386 2.3660254037844393 C -0.011410161513775163 1.7802370205355742 -0.18141016151377531 1.4857883832488645 -0.866025403784439 1.5 C -0.8802370205355741 0.8153847577293366 -0.5857883832488648 0.6453847577293367 0 1"
|
||||
d="M 0 1 C -0.3 0.5 0.3 0.5 0 0 C 0.5 -0.3 0.5 0.3 1 0 C 0.9901923788646685 -0.5830127018922193 1.5098076211353315 -0.2830127018922193 1.5 -0.8660254037844386 C 2.0830127018922195 -0.8758330249197702 1.7830127018922195 -0.356217782649107 2.366025403784439 -0.36602540378443865 C 2.6660254037844386 0.13397459621556135 2.066025403784439 0.13397459621556135 2.366025403784439 0.6339745962155614 C 2.866025403784439 0.3339745962155614 2.866025403784439 0.9339745962155614 3.366025403784439 0.6339745962155614 C 3.8758330249197703 0.9169872981077808 3.3562177826491073 1.2169872981077807 3.866025403784439 1.5 C 3.5830127018922195 2.0098076211353315 3.2830127018922197 1.4901923788646685 3 2 C 2.4169872981077805 2.0098076211353315 2.7169872981077803 1.4901923788646685 2.133974596215561 1.5 C 2.143782217350893 2.0830127018922195 1.6241669750802294 1.7830127018922197 1.6339745962155614 2.3660254037844393 C 1.1339745962155614 2.666025403784439 1.1339745962155614 2.0660254037844394 0.6339745962155614 2.3660254037844393 C 0.1339745962155614 2.666025403784439 0.1339745962155614 2.0660254037844394 -0.3660254037844386 2.3660254037844393 C -0.8758330249197706 2.08301270189222 -0.35621778264910703 1.7830127018922195 -0.866025403784439 1.5 C -0.5830127018922195 0.9901923788646683 -0.2830127018922195 1.5098076211353317 0 1"
|
||||
stroke="black"
|
||||
stroke-width="0.1"
|
||||
stroke-opacity="1"
|
||||
|
@ -44,44 +60,15 @@ textarea {
|
|||
<section id="controls">
|
||||
<fieldset>
|
||||
<legend>Viewbox</legend>
|
||||
<label for="ox">min x</label>
|
||||
<label for="ox">ox</label>
|
||||
<input type="number" min="-500" max="500" value="0" id="ox">
|
||||
<output for="ox"></output>
|
||||
<label for="oy">min y</label>
|
||||
<label for="oy">oy</label>
|
||||
<input type="number" min="-500" max="500" value="0" id="oy">
|
||||
<output for="oy"></output>
|
||||
<label for="width">max x</label>
|
||||
<input type="number" min="-500" max="500" value="190" id="width">
|
||||
<output for="width"></output>
|
||||
<label for="height">max y</label>
|
||||
<input type="number" min="-500" max="500" value="190" id="height">
|
||||
<output for="height"></output>
|
||||
|
||||
<label for="scale">Piece scale</label>
|
||||
<input type="range" min="0" max="1" value="1" step="0.01" id="scale">
|
||||
<output for="scale"></output>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Colours</legend>
|
||||
<label for="col1">Colour 1</label>
|
||||
<input type="color" id="col1" value="#00ff80">
|
||||
<label for="col2">Colour 2</label>
|
||||
<input type="color" id="col2" value="#5500ff">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Tiling</legend>
|
||||
<label for="scale">scale</label>
|
||||
<input type="range" min="1" max="100" value="19" id="scale">
|
||||
<label for="num_iterations">Number of iterations</label>
|
||||
<input type="number" min="1" max="5" value="4" id="num_iterations">
|
||||
<label for="colouring_rule">Colouring rule</label>
|
||||
<textarea id="colouring_rule">
|
||||
const sat = t;
|
||||
const hue = lerp(150,260,y*lerp(0.9,1.1,Math.random()));
|
||||
const lum = lerp(50,80,((1-x)+5*(1-y))/6);
|
||||
return `hsl(${hue},${sat}%,${lum}%)`;
|
||||
</textarea>
|
||||
<input type="number" min="1" max="5" value="2" id="num_iterations">
|
||||
</fieldset>
|
||||
<button type="button" id="rebuild">Rebuild</button>
|
||||
<button type="button" id="finish">Finish</button>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue