{"id":18269796,"url":"https://github.com/r3econ/sprite-additions","last_synced_at":"2025-04-04T23:31:30.342Z","repository":{"id":1880587,"uuid":"2806184","full_name":"r3econ/sprite-additions","owner":"r3econ","description":"Useful UIImage category for handling sprite sheets. This add-on smoothes the way of extracting images from a sprite sheet (texture atlas).","archived":false,"fork":false,"pushed_at":"2017-12-04T21:25:19.000Z","size":1049,"stargazers_count":200,"open_issues_count":2,"forks_count":31,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-04T13:38:43.816Z","etag":null,"topics":["animation","ios","objective-c","sprite","spritesheet"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r3econ.png","metadata":{"files":{"readme":"README.mdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-18T22:51:59.000Z","updated_at":"2025-02-08T15:37:10.000Z","dependencies_parsed_at":"2022-06-25T18:06:03.215Z","dependency_job_id":null,"html_url":"https://github.com/r3econ/sprite-additions","commit_stats":null,"previous_names":["r3econ/uiimage-sprite-additions"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r3econ%2Fsprite-additions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r3econ%2Fsprite-additions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r3econ%2Fsprite-additions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r3econ%2Fsprite-additions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r3econ","download_url":"https://codeload.github.com/r3econ/sprite-additions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266476,"owners_count":20910831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","ios","objective-c","sprite","spritesheet"],"created_at":"2024-11-05T11:37:13.880Z","updated_at":"2025-04-04T23:31:28.415Z","avatar_url":"https://github.com/r3econ.png","language":"Objective-C","readme":"\n[![Build Status](https://travis-ci.org/r3econ/UIImage-Sprite-Additions.svg?branch=master)](https://travis-ci.org/r3econ/UIImage-Sprite-Additions)\n[![CodeFactor](https://www.codefactor.io/repository/github/r3econ/sprite-additions/badge)](https://www.codefactor.io/repository/github/r3econ/sprite-additions)\n[![License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://img.shields.io/badge/License-MIT-brightgreen.svg)\n![Platform](https://img.shields.io/badge/platform-ios%20%7C%20tvos-lightgrey.svg)\n\nUIImage Sprite Additions\n=============\n\nUseful `UIImage` category for handling sprite sheets. This add-on smoothes the way of extracting images from a sprite sheet (texture atlas).\n\nThis can be useful in `UIImageView` animations where animationImages array has to be filled with a set of images representing frames. `UIImage-Sprite` category makes this process trivial by introducing two methods:\n```objective-c\n- (NSArray *)spritesWithSpriteSheetImage:(UIImage *)image spriteSize:(CGSize)size;\n- (NSArray *)spritesWithSpriteSheetImage:(UIImage *)image inRange:(NSRange)range spriteSize:(CGSize)size;\n```\nQuick start\n=======\n\nJust copy `UIImage+Sprite.h` and `UIImage+Sprite.m` to your project or use CocoaPods to install the pod.\n\nInstructions for CocoaPods users:\n\n1. Install [CocoaPods](http://cocoapods.org/) with `gem install cocoapods`.\n2. Create a file in your XCode project called `Podfile` and add the following line:\n\n        pod 'UIImage+SpriteAdditions'\n\n3. Run `pod install` in your xcode project directory. CocoaPods should download and\ninstall the `UIImage+SpriteAdditions` category, and create a new Xcode workspace. Open up this workspace in Xcode.\n\nHow to\n=======\n\nThere are two methods in `UIImage+SpriteAdditions` category. First one:\n```objective-c\n- (NSArray *)spritesWithSpriteSheetImage:(UIImage *)image  spriteSize:(CGSize)size;\n```\nThe method returns an array with `UIImage` objects. Original sprite sheet (image) is sliced into smaller chunks, each of the specified size. \n\nSecond method is very similar:\n```objective-c\n- (NSArray *)spritesWithSpriteSheetImage:(UIImage *)image inRange:(NSRange)range spriteSize:(CGSize)size;\n```\nThis method does exactly the same thing as the latter. However, this time we can specify the range of the chunks we want to get.\n\nNote that for performance reasons you should not fire these methods every time you want to get the array of animation frames. You should rather fire it once and store the output array somewhere. This is because the `CoreGraphics` image manipulation operations (especially on large images) are not so fast and your application may slow down.\n\nI wrote this add-on to facilitate the setup of short animations using `UIImageView`. For more complex animations I recommend using `OpenGLES`. \n \nDemo\n=======\n\n`SpriteAnimationDemo` project presents the usage of the `UIImage+Sprite` methods. The example shows how to create an animated `UIImageView`. This cool explosion sprite sheet which I included in the demo can be found [here](http://gushh.net/blog/free-game-sprites-explosion-3/). I added some numbers to this image to make testing and debugging easier.\n\n![Imgur](https://i.imgur.com/lPNJnso.gif)\n\nLicense\n=======\n\nThis code is distributed under the terms and conditions of the MIT license. \n\nCopyright (c) 2011 Rafal Sroka","funding_links":[],"categories":["spritesheet"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr3econ%2Fsprite-additions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr3econ%2Fsprite-additions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr3econ%2Fsprite-additions/lists"}