This library is a convenient way to create your own SKSpriteNode progress bars in Apple's Sprite Kit. Simply pass in a Texture Atlas containing your sprites and SpriteBar will do the rest.
- Progress bar generation from SKTextureAtlas.
- Automatically scales the animation, allowing you to provide as many frames as you want. From 2 to 100!
- Finds the closest texture file to the percent provided.
- Built in timer function starts animating the progress bar with your graphics.
Simply drag the SpriteBar folder into your project and use #import "SpriteBar.h"
.
Make sure you have followed the naming convention for your texture frames:
(you may specify a texure reference to replace progress using textureReference
)
progress_0.png
progress_10.png
progress_20.png
progress_30.png
etc
// Init and add
SpriteBar *progressBar = [[SpriteBar alloc] initWithTextureAtlas:myCustomTextureAtlas];
progressBar.size = CGSizeMake(50, 50);
[self addChild:progressBar];
[progressBar setProgress:0.2];
// or
[progressBar setProgressWithValue:36 ofTotal:200];
// or
[progressBar startBarProgressWithTimer:10 target:self selector:@selector(timeOver)];
SpriteBar was created by Henry Everett
Twitter: @henryeverett
GitHub: henryeverett
Please fork and contribute to this project!