thooyork / thooClock

jQuery analogue AlarmClock Plugin
MIT License
30 stars 17 forks source link

How to drag/move hour and minutes hand #20

Closed durgesh-sahani closed 5 months ago

durgesh-sahani commented 3 years ago

This is not an issue may be you can consider as a feature request

It is really cool library, I was able to show clock very quickly but now I want to move it's hour and minutes hand similar to this website: https://www.roomrecess.com/Tools/InteractiveClock/play.html

I'm able to click on canvas but not sure how access that specific line stroke

$('#canvas').click(function(e){
    console.log('Canvas clicked');
});

Can anyone please help me with this.

Thanks in advance.

thooyork commented 2 years ago

Thats not trivial. Since this clock is implemented with a HTML canvas (and not SVG) you can't access objects inside the canvas directly (like the hands). Since canvas doesnt know objects it is just a 2 dimensional pixel -area. What you can do is something like in this example: https://stackoverflow.com/questions/5559248/how-to-create-a-draggable-line-in-html5-canvas