change is such hard work

In this version I removed lots of repeated calls to self.layer.contents=… in the animation code, by modifying and checking a frame number instead. When the number changes, the code sets the layer contents to the next image. Eventually I’ll move this code into an Animation class, which will be used by both the sprites and …

dance to the beat

In this version I added a fixed time step to the display link update callback. I noticed very small increases and decreases in the movement rate of the green meanies, so by fixing the update to a fixed time step, it appeared to help a bit. This is also a useful technique for ensuring repeatable …

feeling animated

Did some refactoring so that the CADisplayLink is created in the View Controller, calling to the GridView and SpriteGroup classes with the current frame update interval in an update method; and also added some animations for tiles and sprites. The transforms are created in response to user interaction, but all the animation updates, movement updates …

meanie greenies on two screenies

Removing jitter and getting a better frame rate by reducing the number of sprites on the map to 100 moving sprites, and by culling sprites when they are not visible – sprites are “culled” by removing them from their parent sprite group superview – and added back when they are visible.

meanie greenies

I’ve added some sprites and a sprite group. To update the scroll content offset a Core Animation translation is applied – this gives the impression of scrolling. A CADisplayLink installed in a background thread is used to update the position of each sprite in each frame interval, using linear interpolation.

naive scrolling tiles

After watching a talk from Rob Rhyne at NSConference 5 this year, I decided to have a go a creating a “naive implementation” of a scrolling tile view, which could be used in games and apps. This is a custom UIView which makes use of Core Animation transformations and CALayer contents to create an adequately-speedy …