Sure! You want an HTML + CSS + JS web tool that generates a Minecraft-style pixel circle (using colored square blocks) on an XZ grid (like Minecraft's horizontal plane), with these features:
- User inputs:
- Circle color
- Start degree
- End degree
- Debug toggle (to see pixel grid / indices)
- X and Z center coordinates
- Zoom level (pixel size per block)
- Show the resulting pixel circle slice on canvas or div grid
- Provide a shareable URL preserving parameters (using
#/ fragment)
Below is a complete example implementing this. You can open it in any modern browser. It uses a canvas to draw colored squares representing Minecraft blocks in an XZ plane.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Minecraft Pixel Circle Generator</title>
<style>
body {
margin: 1rem;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background: #222;
color: #eee;
}
label {
margin: 0 0.5rem 0 0;
}
input[type="number"],
input[type="color"],
input[type="range"] {
width: 5rem;
}
.controls {
margin-bottom: 1rem;
display: flex;
flex-wrap: wrap;
gap: 1rem 1rem;
align-items:center;
}
canvas {
background: #111;
image-rendering: pixelated;
border: 1px solid #444;
cursor: crosshair;
}
.debug {
font-size: 0.8rem;
color: #999;
}
a.sharelink {
color: #0af;
word-break: break-all;
}
</style>
</head>
<body>
<h1>Minecraft Pixel Circle Generator</h1>
<div class="controls">
<label>Color: <input type="color" id="color" value="#00cc00" title="Circle Color"/></label>
<label>Start°: <input type="number" id="startdeg" min="0" max="360" value="0" title="Start Degree"/></label>
<label>End°: <input type="number" id="enddeg" min="0" max="360" value="360" title="End Degree"/></label>
<label>X center: <input type="number" id="centerx" value="0" step="1" title="X (East-West) Coordinate"/></label>
<label>Z center: <input type="number" id="centerz" value="0" step="1" title="Z (North-South) Coordinate"/></label>
<label>Zoom: <input type="number" id="zoom" min="2" max="40" value="12" step="1" title="Block pixel size"/></label>
<label>Radius: <input type="number" id="radius" min="1" max="64" value="16" step="1" title="Circle radius in blocks"/></label>
<label>Debug: <input type="checkbox" id="debug" title="Show pixel grid"/></label>
<button id="sharebtn" title="Generate shareable URL">Share</button>
</div>
<canvas id="canvas" width="512" height="512" style="width:512px; height:512px;"></canvas>
<p>Click canvas to move center coordinates</p>
<p>Share link: <a href="#" id="sharelink" class="sharelink" target="_blank" rel="noopener noreferrer"></a></p>
<script>
(() => {
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
const colorInput = document.getElementById("color");
const startDegInput = document.getElementById("startdeg");
const endDegInput = document.getElementById("enddeg");
const centerXInput = document.getElementById("centerx");
const centerZInput = document.getElementById("centerz");
const zoomInput = document.getElementById("zoom");
const debugInput = document.getElementById("debug");
const radiusInput = document.getElementById("radius");
const shareBtn = document.getElementById("sharebtn");
const shareLink = document.getElementById("sharelink");
// We'll map a square area of side length 2*radius + 1 around center XZ
function degToRad(deg) {
return deg * Math.PI / 180;
}
// Given parameters, render the pixel circle slice
function draw() {
const w = canvas.width;
const h = canvas.height;
let centerX = parseInt(centerXInput.value);
let centerZ = parseInt(centerZInput.value);
let zoom = parseInt(zoomInput.value);
let radius = parseInt(radiusInput.value);
let startDeg = parseFloat(startDegInput.value) % 360;
if (startDeg < 0) startDeg += 360;
let endDeg = parseFloat(endDegInput.value) % 360;
if (endDeg < 0) endDeg += 360;
const color = colorInput.value;
const debug = debugInput.checked;
// Clear whole canvas
ctx.clearRect(0, 0, w, h);
// Calculate grid size
const gridSize = radius * 2 + 1;
// Resize canvas to fit full grid with current zoom
// Note: we keep canvas fixed size, so we just center grid inside it.
// Calculate upper-left corner of grid in canvas pixels:
// We'll center the (centerX, centerZ) block in the middle of canvas.
const pixelSize = zoom;
// Calculate origin pixel (canvas coordinates) for worldCenter block:
const originX = Math.floor(w / 2) - pixelSize * centerX;
const originZ = Math.floor(h / 2) - pixelSize * centerZ;
// Draw each block in the bounding grid (centerX-radius ... centerX+radius)
// For each block, test if it falls within radius, and between start and end angle
// Important: In Minecraft XZ:
// X: east-west, Z: north-south
// We treat X horizontal, Z vertical for canvas drawing:
// Canvas Y = vertical axis (Z)
// Canvas X = horizontal axis (X)
for (let x = centerX - radius; x <= centerX + radius; x++) {
for (let z = centerZ - radius; z <= centerZ + radius; z++) {
// Compute distance from center
const dx = x - centerX;
const dz = z - centerZ;
const dist = Math.sqrt(dx * dx + dz * dz);
if (dist > radius + 0.5) continue; // outside radius (rounded properly)
// Compute angle in degrees from center to (x,z)
// angle 0° pointing to +X (East), increasing CCW based on normal math,
// but Minecraft compass: positive X East, positive Z South, so we adjust accordingly.
// We define:
// 0° = +X direction
// angle = atan2(dz, dx) in degrees
// atan2 returns in range -180 to 180, convert to 0 - 360°
let angle = (Math.atan2(dz, dx) * 180 / Math.PI);
if (angle < 0) angle += 360;
// Check if angle is within the start-end degree range (consider wrap-around)
let insideAngle = false;
if (startDeg <= endDeg) {
if (angle >= startDeg && angle <= endDeg) insideAngle = true;
} else {
// e.g. start=300 end=60 wrap-around
if (angle >= startDeg || angle <= endDeg) insideAngle = true;
}
if (!insideAngle) continue;
// Draw the block square on canvas
const px = originX + x * pixelSize;
const pz = originZ + z * pixelSize;
ctx.fillStyle = color;
ctx.fillRect(px, pz, pixelSize, pixelSize);
if (debug) {
// Draw grid lines
ctx.strokeStyle = "#666";
ctx.lineWidth = 1;
ctx.strokeRect(px, pz, pixelSize, pixelSize);
// Coordinate labels
ctx.fillStyle = "#aaa";
ctx.font = (pixelSize / 3) + "px monospace";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(`(${x},${z})`, px + pixelSize / 2, pz + pixelSize / 2);
}
}
}
// Draw center crosshair
const cX = originX + centerX * pixelSize;
const cZ = originZ + centerZ * pixelSize;
ctx.strokeStyle = "#f00";
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(cX, cZ - pixelSize);
ctx.lineTo(cX, cZ + pixelSize);
ctx.moveTo(cX - pixelSize, cZ);
ctx.lineTo(cX + pixelSize, cZ);
ctx.stroke();
}
function updateFromHash() {
if (!location.hash) return;
// hash format: #/color/start/end/x/z/zoom/radius/debug
try {
const parts = location.hash.slice(2).split("/");
if (parts.length < 8) return;
const [color, startdeg, enddeg, centerx, centerz, zoom, radius, debug] = parts;
colorInput.value = color || "#00cc00";
startDegInput.value = startdeg || "0";
endDegInput.value = enddeg || "360";
centerXInput.value = centerx || "0";
centerZInput.value = centerz || "0";
zoomInput.value = zoom || "12";
radiusInput.value = radius || "16";
debugInput.checked = debug === "1";
} catch (e) {
console.warn("Invalid hash:", e);
}
}
function updateHash() {
// Save current settings to location.hash
const color = colorInput.value;
const startdeg = parseFloat(startDegInput.value) || 0;
const enddeg = parseFloat(endDegInput.value) || 360;
const centerx = parseInt(centerXInput.value) || 0;
const centerz = parseInt(centerZInput.value) || 0;
const zoom = parseInt(zoomInput.value) || 12;
const radius = parseInt(radiusInput.value) || 16;
const debug = debugInput.checked ? 1 : 0;
const newHash = `#/${color}/${startdeg}/${enddeg}/${centerx}/${centerz}/${zoom}/${radius}/${debug}`;
history.replaceState(null, "", newHash);
shareLink.href = location.href;
shareLink.textContent = location.href;
}
// Event listeners
const inputs = [colorInput, startDegInput, endDegInput, centerXInput, centerZInput, zoomInput, radiusInput, debugInput];
inputs.forEach(input => input.addEventListener("input", () => {
draw();
updateHash();
}));
// Share button also updates link & copies URL
shareBtn.addEventListener("click", () => {
updateHash();
shareLink.select?.();
try {
navigator.clipboard.writeText(location.href);
alert("Share URL copied to clipboard!");
} catch {
// fallback
prompt("Copy this URL to share:", location.href);
}
});
// Click canvas to move the centerX, centerZ to clicked block
canvas.addEventListener("click", e => {
const rect = canvas.getBoundingClientRect();
const cx = e.clientX - rect.left;
const cz = e.clientY - rect.top;
// Map canvas pixel position to Minecraft block coords:
// blockX = (cx - originX) / pixelSize
// blockZ = (cz - originZ) / pixelSize
const zoom = parseInt(zoomInput.value);
const centerX = parseInt(centerXInput.value);
const centerZ = parseInt(centerZInput.value);
const originX = Math.floor(canvas.width / 2) - zoom * centerX;
const originZ = Math.floor(canvas.height / 2) - zoom * centerZ;
const xBlock = Math.floor((cx - originX) / zoom);
const zBlock = Math.floor((cz - originZ) / zoom);
centerXInput.value = xBlock;
centerZInput.value = zBlock;
draw();
updateHash();
});
// Init
updateFromHash();
draw();
updateHash();
})();
</script>
</body>
</html>
How it works:
- You pick a color for the circle.
- You set start and end degrees (0 to 360) - degrees origin is +X axis (East), measured counterclockwise.
- Set center X,Z coordinates for the circle center.
- Radius sets the circle radius in Minecraft blocks.
- Zoom sets the size in pixels per block.
- Debug mode toggles drawing grid lines and coordinate labels over each block.
- Click on the canvas to move the circle center to the selected block.
- Press "Share" to generate a shareable URL with all parameters encoded in the URL hash (
#/...).
- The "Share link" below shows the current URL which you can copy/share.
This tool should allow you to generate any circle slice for Minecraft pixel art or build planning.
If you'd like me to add any other features, or export a block list, just ask!