How to make animate in continue range in watchkit?


#1

0
down vote
favorite
I have an image on WKInterfacecontroller. and i have 10 image frames (frame_0.png to frame_9.png)

in normal when we want to make that image animated we can simple do like this:

stopWatchAnimateImage.setImageNamed("frame_")
stopWatchAnimateImage.startAnimating()

or we can make animate with Range:

stopWatchAnimateImage.setImageNamed("frame_")
stopWatchAnimateImage.startAnimatingWithImagesInRange(NSMakeRange(0, 10) , duration: 10 , repeatCount: 0)

but now i want my Image start animated from the frame_3 and continue to make animate after the image run to frame_9

(my image will run from frame 3 -4 -5…to 9 and so on continue to 0 -1 - 2- 3…) How can i do that?


#2

Why not make 2 animations ? First one 3-10, second one 1-10 with repeat…


#3

thanks,
After check some solution, finally we can make this simple like this: make one animate with range and make delay time , after that we can continue make a continue animated like this:

stopWatchAnimateImage.setImageNamed("frame_")
stopWatchAnimateImage.startAnimatingWithImagesInRange(NSMakeRange(3, 9) , duration: 7 , repeatCount: 1)
dispatch_after(dispatch_time(
            DISPATCH_TIME_NOW,
            Int64(7 * Double(NSEC_PER_SEC))
            ), dispatch_get_main_queue(), { () -> Void in
                self.stopWatchAnimateImage.startAnimating()

        })