diff options
Diffstat (limited to 'share')
-rwxr-xr-x | share/hackvr/examples/clock/generate.py | 10 | ||||
-rwxr-xr-x | share/hackvr/examples/clock/run | 7 | ||||
-rwxr-xr-x | share/hackvr/examples/clock/set_clock.sh | 7 |
3 files changed, 24 insertions, 0 deletions
diff --git a/share/hackvr/examples/clock/generate.py b/share/hackvr/examples/clock/generate.py new file mode 100755 index 0000000..8eba1a6 --- /dev/null +++ b/share/hackvr/examples/clock/generate.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +import math + +for i in range(1,13): + x=math.floor(math.sin(math.pi / 6 * i) * 1000) / 100 + y=math.floor(math.cos(math.pi / 6 * i) * 1000) / 100 + print("_clock_face_digit_{}_ addshape 2 4 {} {} 0 {} {} 0 {} {} 0 {} {} 0\n".format(i,x-1,y-1,x+1,y-1,x+1,y+1,x-1,y+1)) + print("_clock_face_hand_hour_ addshape 2 3 -1 -1 0 0 5 0 1 -1 0\n") + print("_clock_face_hand_minute_ addshape 2 3 -.75 -.75 0 0 8 0 .75 -.75 0\n") + print("_clock_face_hand_second_ addshape 2 3 -.25 -.25 0 0 10 0 .25 -.25 0\n") diff --git a/share/hackvr/examples/clock/run b/share/hackvr/examples/clock/run new file mode 100755 index 0000000..1341b89 --- /dev/null +++ b/share/hackvr/examples/clock/run @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +nonblocktail \ + <(echo $USER move 0 0 -30) \ + <(./generate.py ) \ + <(while true;do ./set_clock.sh ;sleep 1;done) \ + /dev/stdin 2>/dev/null \ + | hackvr 2>/dev/null diff --git a/share/hackvr/examples/clock/set_clock.sh b/share/hackvr/examples/clock/set_clock.sh new file mode 100755 index 0000000..14abeaf --- /dev/null +++ b/share/hackvr/examples/clock/set_clock.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +hour=$(date +%H | sed 's/^0//') +minute=$(date +%M | sed 's/^0//') +second=$(date +%S | sed 's/^0//') +printf "_clock_face_hand_hour_ rotate 0 0 -%s\n" "$[hour * 30]" +printf "_clock_face_hand_minute_ rotate 0 0 -%s\n" "$[minute * 6]" +printf "_clock_face_hand_second_ rotate 0 0 -%s\n" "$[second * 6]" |