2
$\begingroup$

I have designed a ClockGauge and wish to use three different images for the hour, minute and second hands.The images are not rectangular and are not symmetrical. The code used is below:

'ClockGauge[ AbsoluteTime[], ImageSize -> Large, 
 GaugeLabels -> {Placed["DateShort", Top], "Value"}, 
 GaugeMarkers -> {minuteHand, secondHand, hourHand}, 
 PlotLabel -> Style["Mallacoota", Large, Bold] ]'

The output is: enter image description here

I want to specify that, for example, the seahorse rotates about the tip of its tail and the tip of its snout indicates the time. How should I modify the command.

The images are imported from the hard drive.

Thanks for helping.

The images used as clock hands are below:

enter image description here enter image description here enter image description here

$\endgroup$
1
  • $\begingroup$ A lot depends on the images you're using. Please edit your question to add a copy of each of them. $\endgroup$
    – creidhne
    Jan 13 at 0:34
2
$\begingroup$

(1) Rotate slightly and crop the image so that the tip of the tail is at the bottom-left corner and the tip of the snout is at the bottom-right corner of the bounding rectangle. (2) ImagePad to have the image on the upper part of the rectangle:

seahorse = Import["https://i.stack.imgur.com/sRwYn.png"];
seahorse2 = RemoveBackground @ ImageCrop @ Rasterize @ Rotate[seahorse, 2 Degree];

hand = ImagePad[seahorse2, {{-5, 40}, {ImageDimensions[seahorse2][[2]], 0}}];

Dynamic @ Refresh[ClockGauge[Round @ AbsoluteTime[], ImageSize -> 500, 
   GaugeLabels -> {Placed["DateShort", Top], "Value"}, 
   GaugeMarkers -> {None, None, hand}, 
   PlotLabel -> Style["Mallacoota", Large, Bold]], 
  UpdateInterval -> 1]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks for the response. $\endgroup$ Jan 13 at 21:49
  • $\begingroup$ Why did you add 40 pixels to the length of the image? Also, some of the standard clock hands are centred about a point within the image. How do I specify that the image rotates about a specific pixel coordinate? $\endgroup$ Jan 13 at 21:56
  • $\begingroup$ @JohnBaratta, added 40 pixels on the right to make the snout point to the ticks (try changing 40 to 0 to see what we get without the padding on the right). Re changing the point to rotate around, it should be possible but can't think of a quick way otomh. $\endgroup$
    – kglr
    Jan 14 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.