Код: Выделить всё
let canvas, ctx, h, w;
function init() {
canvas = document.getElementById("digiCanvas");
canvas.style.background = "olive";
ctx = canvas.getContext("2d");
w = canvas.width;
h = canvas.height;
for (let i = 0; i < 1000; i++) {
var x = Math.random() * w,
y = Math.random() * h,
width = Math.random() * w,
height = Math.random() * h;
ctx.strokeStyle = "#4d6e45";
ctx.strokeRect(x, y, width, height);
ctx.strokeStyle = "#e6e200";
ctx.strokeRect(x, y, width, height);
var x = Math.random() * w,
y = Math.random() * h,
width = Math.random() * w,
height = Math.random() * h;
ctx.strokeStyle = "#4d6e45";
ctx.strokeRect(x, y, width, height);
ctx.strokeStyle = "gold";
}
const img = document.createElement("img");
img.src = "https://i.ibb.co/spMXMkg5/Pngtree-watercolor-of-pink-hibiscus-flowers-13017491.png";
const pat = ctx.createPattern(img, "no-repeat");
ctx.rect(6, 6, 297, 297);
ctx.fillStyle = pat;
ctx.fill();
ctx.fillStyle = "gold";
ctx.fillStyle = "rgba(255, 255, 255, 0.5)";
ctx.fillRect(18, 320, 272, 28);
ctx.fillStyle = "navy";
ctx.font = "21px Papyrus";
ctx.fillText(" ݁ .᪥.Hibiscus rosa-sinensis .᪥. ݁", 18, 339);
}< /code>
html {
display: flex;
justify-content: center;
align-items: center;
}
html>* body {
background: #eedc82;
}
canvas {
border: 1px dashed #c94484;
}< /code>
Canvas
Your browser does not support the canvas tag.
Я мог бы достичь желаемой ткани-текстуры, как вы думаете, это хорошая идея, чтобы превратить ее в электронную карту?
Подробнее здесь: https://stackoverflow.com/questions/796 ... s-to-creat