xxxxxxxxxx
53
// 18.11.2023
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255);
// Draw Number 0
drawZero(50, 50);
// Draw Number 1
drawOne(150, 50);
// Draw Number 2
drawTwo(250, 50);
// Continue similarly for the other numbers...
}
function drawZero(x, y) {
// Example for the number 0
beginShape();
vertex(x + 20, y);
vertex(x, y + 20);
vertex(x, y + 80);
vertex(x + 20, y + 100);
vertex(x + 80, y + 100);
vertex(x + 100, y + 80);
vertex(x + 100, y + 20);
vertex(x + 80, y);
endShape(CLOSE);
}
function drawOne(x, y) {
// Example for the number 1
line(x + 50, y, x + 50, y + 100);
}
function drawTwo(x, y) {
// Improved representation for the number 2
noFill();
beginShape();
vertex(x + 20, y + 10);
bezierVertex(x + 40, y - 10, x + 80, y - 10, x + 90, y + 10);
bezierVertex(x + 100, y + 30, x + 50, y + 60, x + 80, y + 80);
bezierVertex(x + 100, y + 90, x + 60, y + 100, x + 40, y + 80);
bezierVertex(x + 20, y + 60, x + 30, y + 30, x + 20, y + 10);
endShape();
}
// Continue similarly for the other numbers...