feat: Change file structure
- Move return object to named export for 11ty config - screens is now view - 11ty data files moved to view/_data - templates is now view/_includes - Both are the default directories - data is now used as intended, for user data - Update index to reflect filenames and structure
This commit is contained in:
parent
610e22b3c9
commit
b67a8a893a
78 changed files with 21 additions and 19 deletions
|
|
@ -1,69 +0,0 @@
|
|||
---
|
||||
title: 10print
|
||||
tags:
|
||||
- demoExample
|
||||
---
|
||||
{% layout 'hippie/simple.liquid' %}
|
||||
|
||||
{% block style %}
|
||||
<style>
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<canvas id="pattern"></canvas>
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
<script>
|
||||
const canvas = document.getElementById('pattern');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
const lineWidth = 20;
|
||||
const randomSeed = Math.random;
|
||||
|
||||
// Function to draw the 10PRINT pattern
|
||||
function draw10Print() {
|
||||
// Clear the canvas
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Set line style
|
||||
ctx.strokeStyle = 'black';
|
||||
ctx.lineWidth = 2;
|
||||
|
||||
// Loop through the canvas grid
|
||||
for (let x = 0; x < canvas.width; x += lineWidth) {
|
||||
for (let y = 0; y < canvas.height; y += lineWidth) {
|
||||
// Randomly choose between two diagonal lines
|
||||
if (randomSeed() > 0.5) {
|
||||
// Draw line from top-left to bottom-right
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, y);
|
||||
ctx.lineTo(x + lineWidth, y + lineWidth);
|
||||
ctx.stroke();
|
||||
} else {
|
||||
// Draw line from top-right to bottom-left
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x + lineWidth, y);
|
||||
ctx.lineTo(x, y + lineWidth);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function resizeCanvas() {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
}
|
||||
|
||||
resizeCanvas();
|
||||
draw10Print();
|
||||
|
||||
// window.addEventListener('resize', resizeCanvas);
|
||||
canvas.addEventListener('click', draw10Print);
|
||||
</script>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue