Alright, so I don't know the name for this but I have a sprite kit game (a runner game) that, when it's game over, is going to have a "save me" button and a timer that runs out accordingly. When the timer runs out, you can no longer click the button and save the character.
I don't want to display this timer in text however- I want a circle that "unwinds itself," if you will, and disappears at the rate that the timer runs out. I.e. when the timer reaches 0, the circle has fully disappeared. The circle disappears degree by degree in a clockwise motion in accordance with the timer.
Here are some pictures to explain what I'm talking about.
How would I do this?
By changing the
path
property of anSKShapeNode
at a fixed interval, you can create a frame-by-frame animation sequence. To create the animation, set thepath
property to a sequence of shapes that starts with a circle and ends with nothing. You can use UIBezierPath, a wrapper forCGPath
, to create shapes for the animation using the following steps:startAngle
toendAngle
endAngle
by a fixed amountHere's an implementation of the above steps:
and a video clip: