Image sheets are 2D animations that compile multiple frames into a single texture image. This is an efficient way to save on texture memory. It is beneficial for mobile devices and minimizes the loading time.
The graphics.newImageSheet
function creates a new image sheet. Refer to the following code:
graphics.newImageSheet( filename, [baseDir, ] options )
For example, the number of frames in the image sheet is assumed to be floor(imageWidth/frameWidth) * floor(imageHeight/frameHeight)
. The first frame is placed at the top-left position and reads left to right and follows the next row, if applicable. The following image sheet has five frames that are 128 x 128 pixels each. The image sheet image is 384 pixels x 256 pixels altogether. If it were to be integrated in Corona, a sample method would be displayed like this:
local options = { width = 128, height = 128, numFrames = 5, sheetContentWidth=384, sheetContentHeight=256 } local sheet = graphics.newImageSheet...