We have captured 36 images of an object as it is being pivoted and rotated around 360 degrees.
With a bit of code you can swipe left or right to turn the image in either direction. This works to turn off visibility on all other images except one.
All works fine but as each image of the 36 averages around 900x 500 pixels, this is a lot to load into texture memory at once.
Other than loading images and removing them all the time so that only 3-6 remain in texture memory, is there any other way this could be achieved? My guess is that they should all fit on around 10 sprite sheets which will reduce texture memory for a start, but is there something more dramatic that can be done?
Here is the code for alternating each image btw if this helps:
ObjImg[1].isVisible = true ------------------ -- SWIPE Obj IMAGES ------------------ local currentObj = 1 local lock = false local function toggleObj (direction) if not lock then ObjImg[currentObj].isVisible = false if direction == "left" then if currentObj==36 then currentObj = 1; end ObjImg[currentObj+1].isVisible = true currentObj = currentObj + 1 else if currentObj==1 then currentObj = 36; end ObjImg[currentObj-1].isVisible = true currentObj = currentObj - 1 end -- set Lock lock = true composer.timerStash.lock = timer.performWithDelay( 50, function () lock=false; end, 1 ) end end image.swipeLayer.isHitTestable = true local prevX = 0 local function startDrag( event ) if event.phase == "began" then prevX = event.x end if event.x \> prevX then print 'swipe right' toggleObj("right") elseif event.x \< prevX then print 'swipe left' toggleObj("left") end prevX = event.x end image.swipeLayer:addEventListener("touch", startDrag)