3dots
Gast
Hallo,
ich versuche gerade ein Widget für das Dashboard zu erstellen. Dabei möchte ich, dass das Widget auch eine analoge Uhr enthält, ähnlich wie World-Clock. Leider habe ich keine Ahnung, wie ich sowas programmieren kann.
Ich nehme an, ich brauche Canvas. Auf Apple.de habe ich ein Tutrorial gefunden, kann es aber nicht umsetzen.
Mein Java-Code sieht so aus:
function drawHands (hoursAngle, minutesAngle, secondsAngle)
{
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.clearRect(0, 0, 100, 100);
context.save();
context.translate(100/2, 100/2);
context.save();
context.rotate(hoursAngle);
context.drawImage(hourhand, -4, -28, 9, 25);
context.restore();
context.save();
context.rotate (minutesAngle);
context.drawImage (minhand, -8, -44, 18, 53);
context.restore();
context.rotate (secondsAngle);
context.drawImage (sechand, -4, -52, 8, 57);
context.restore();
}
und mein html-Code so:
Kann mir jemand helfen, oder kennt jemand ein Tutorial, was einem erklärt, wie man ein Uhr-Widget erstellt?
Danke!
ich versuche gerade ein Widget für das Dashboard zu erstellen. Dabei möchte ich, dass das Widget auch eine analoge Uhr enthält, ähnlich wie World-Clock. Leider habe ich keine Ahnung, wie ich sowas programmieren kann.
Ich nehme an, ich brauche Canvas. Auf Apple.de habe ich ein Tutrorial gefunden, kann es aber nicht umsetzen.
Mein Java-Code sieht so aus:
function drawHands (hoursAngle, minutesAngle, secondsAngle)
{
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.clearRect(0, 0, 100, 100);
context.save();
context.translate(100/2, 100/2);
context.save();
context.rotate(hoursAngle);
context.drawImage(hourhand, -4, -28, 9, 25);
context.restore();
context.save();
context.rotate (minutesAngle);
context.drawImage (minhand, -8, -44, 18, 53);
context.restore();
context.rotate (secondsAngle);
context.drawImage (sechand, -4, -52, 8, 57);
context.restore();
}
und mein html-Code so:
Code:
[FONT=Helvetica]<div class="clock">[/FONT][FONT=Helvetica] AM[/FONT][FONT=Helvetica] <canvas id="myCanvas" width='100' height='100'/>[/FONT][FONT=Helvetica]</div>[/FONT]
Danke!