Advertisement
wariat

clock.sh

Apr 5th, 2023
1,659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.75 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. CLOCK_DIAM=64
  4. H_HAND_D=$[ $( date "+%-I" ) * 30 + $( date "+%-M" ) / 2 ]
  5. M_HAND_D=$[ $( date "+%-M" ) * 6                         ]
  6. M_HAND="path 'M 0,0 L 0,-4 M -1,-4 L 0,$[${CLOCK_DIAM} * -9 / 10] L 1,-4'"
  7. H_HAND="path 'M 0,0 L 0,-4 M -1,-4 L 0,$[${CLOCK_DIAM} / -2     ] L 1,-4'"
  8. H_MARK="path 'M 0,$[${CLOCK_DIAM} * -95 / 100 ] L 0,$[${CLOCK_DIAM} * -75 / 100 ]  
  9.              M 0,$[${CLOCK_DIAM} *  95 / 100 ] L 0,$[${CLOCK_DIAM} *  75 / 100 ]'"
  10.  
  11. convert                                                                             \
  12.     -size "$[${CLOCK_DIAM} * 2]x$[${CLOCK_DIAM} * 2]" xc:transparent                \
  13.     -fill "#0c8cfd80"                                                               \
  14.     -stroke "#101010"                                                               \
  15.     -strokewidth "2"                                                                \
  16.     -draw "translate ${CLOCK_DIAM},${CLOCK_DIAM} circle 0,0 0,$[${CLOCK_DIAM} - 1]" \
  17.     -draw "rotate ${M_HAND_D} translate ${CLOCK_DIAM},${CLOCK_DIAM} ${M_HAND}"      \
  18.     -draw "rotate ${H_HAND_D} translate ${CLOCK_DIAM},${CLOCK_DIAM} ${H_HAND}"      \
  19.     -strokewidth "1"                                                                \
  20.     -draw "           translate ${CLOCK_DIAM},${CLOCK_DIAM} ${H_MARK}"              \
  21.     -draw "rotate 30  translate ${CLOCK_DIAM},${CLOCK_DIAM} ${H_MARK}"              \
  22.     -draw "rotate 60  translate ${CLOCK_DIAM},${CLOCK_DIAM} ${H_MARK}"              \
  23.     -draw "rotate 90  translate ${CLOCK_DIAM},${CLOCK_DIAM} ${H_MARK}"              \
  24.     -draw "rotate 120 translate ${CLOCK_DIAM},${CLOCK_DIAM} ${H_MARK}"              \
  25.     -draw "rotate 150 translate ${CLOCK_DIAM},${CLOCK_DIAM} ${H_MARK}"              \
  26.     clock.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement