![]() Suppose you want to draw a hand at 12 minutes past. ![]() I had a request to post the maths for this. Both sin and cos are available in WatchKit, so convert the hours/minutes into radians and calculate the end coordinate of your watch hand, treating the length of the hand as the hypotenuse of a right-angled triangle. In fact, by making the colour a parameter of drawLine(), you’ve got the method to draw the second hand too.Īs for the maths to draw the hands in the right place, it’s trigonometry. So if you followed along, you can replace your Treasure Map image with a watch face image and use the createContext(), drawLine() and appl圜ontextToImage() methods to draw the hour and minute hands. I already blogged about how to get the current time and how to draw graphics on top of an image.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |