Skip to content

Instantly share code, notes, and snippets.

@auselen
Created August 25, 2015 08:37
Show Gist options
  • Save auselen/b28e9a08f0df6ebe2158 to your computer and use it in GitHub Desktop.
Save auselen/b28e9a08f0df6ebe2158 to your computer and use it in GitHub Desktop.
smartwatch2 polar clock face generator
#!/bin/sh
#create rings
echo creating hours ring
for i in $( seq 6 6 360 ); do convert -size 220x176 -depth 16 xc:transparent -fill none -stroke DarkOrange3 -draw "stroke-width 16 ellipse 110,88 74,74 270,$((270 + i))" polar_hours_$i.png; done
echo creating minutes ring
for i in $( seq 6 6 360 ); do convert -size 220x176 -depth 16 xc:transparent -fill none -stroke DarkOrange4 -draw "stroke-width 16 ellipse 110,88 58,58 270,$((270 + i))" polar_minutes_$i.png; done
echo creating seconds ring
for i in $( seq 6 6 360 ); do convert -size 220x176 -depth 16 xc:transparent -fill none -stroke peru -draw "stroke-width 16 ellipse 110,88 42,42 270,$((270 + i))" polar_seconds_$i.png; done
# create preview image
echo creating preview image
composite polar_hours_96.png polar_minutes_264.png polar_preview.png
composite polar_seconds_174.png polar_preview.png polar_preview.png
echo creating empty image
convert -size 210x170 xc:transparent polar_empty.png
# create levellists
for t in "hours" "minutes" "seconds"
do
filename="clock_widget_polar_$t.xml"
echo creating $filename
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" > $filename
echo "<level-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >" >> $filename
# use same empty class
echo "<item android:drawable=\"@drawable/polar_empty\"/>" >> $filename
for i in $( seq 6 6 360 ); do echo "<item android:drawable=\"@drawable/polar_${t}_${i}\"/>" >> $filename; done
echo "</level-list>" >> $filename
done
# minutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment