Feb 27 2011 20:25
There has been some new features added to SpriteSheet functionality. In addition to the Zwoptex Flash format LimeJS now also supports the newer Zwoptex (cocos2d) format and JSON format present in TexturePacker. While you could use trimming before you now can pack your files even more by using rotation switching.
We have put a parser logic for each format in the special object that needs to be included with goog.require() and passed in to the SpriteSheet constructor as a third parameter. All currently supported parser objects are:
- lime.parser.ZWOPTEX - Original Zwoptex format, also known as Zwoptex Flash format or cocos2d-0.99.4
- lime.parser.ZWOPTEX2 - New Zwoptex format, also known as Zwoptex Generic or cocos2d
- lime.parser.JSON - JSON format that can be exported from TexturePacker
So your new code may look…
Feb 21 2011 23:23
LimeJS now has full support of sprite sheets. This means that you can gather your image assets to the same file and define areas that contain only the parts you are interested about. This lets you load multiple images with one request and export your whole keyframe animation with single file.
To define a fill for a part of a image there is a new Frame fill. It takes in an image(as url or Image element) and frame definition(as goog.math.Rect object or numbers). You can then use the Frame fill instance as you would use any other fill. All the same methods can be used for Frame as for Image fill(this covers repeating patterns) and performance should be also similar.
var frame = new lime.fill.Frame('sheet.png', 20, 30, 200, 150); //x , y, width, height
By default the fill….