Hallo miteinander
wenn ich mit canvas so eine Art Button erstelle, wie hier im Beispiel:
wie kann ich die mit dem eventHandler ansprechen. Oder geht das nicht?
GzG
Joachim
wenn ich mit canvas so eine Art Button erstelle, wie hier im Beispiel:
Code:
function roundedButton(a)
{
// a : Anzahl Buttons
for (var i = 0; i< a; i++) {
ctx.fillStyle=rects.col1;
roundedRect(rects.x, rects.y, rects.w, rects.h,10);
ctx.fillStyle=rects.col2;
roundedRect(rects.x+5, rects.y+5, rects.w-10, rects.h-10,10);
ctx.fill();
}
}
function roundedRect(x, y, width, height, radius) {
ctx.beginPath();
ctx.moveTo(x, y + radius);
ctx.lineTo(x, y + height - radius);
ctx.arcTo(x, y + height, x + radius, y + height, radius);
ctx.lineTo(x + width - radius, y + height);
ctx.arcTo(x + width, y + height, x + width, y + height-radius, radius);
ctx.lineTo(x + width, y + radius);
ctx.arcTo(x + width, y, x + width - radius, y, radius);
ctx.lineTo(x + radius, y);
ctx.arcTo(x, y, x, y + radius, radius);
ctx.stroke();
}
GzG
Joachim
Zuletzt bearbeitet von einem Moderator: