Hi,
I’m using this in my implementation
https://github.com/dedoubleyou1/Corona-Page-Curl-Effect
With that I can curl an image from the right but I would also like to implement so that I can curl from the left (and later on from the top and bottom of the image).
However, I’m having problem understanding the code:
local function maskFrame () local from = "right" if fingerX \< display.contentWidth and fingerX \> display.contentWidth / 2 then from = "right" elseif fingerX \> 0 and fingerX \< display.contentWidth / 2 then from = "left" end -- When the picture is being released it does different stuff if isDrag == false then print("drag") if from == "right" then --fingerX \< display.contentWidth and fingerX \> display.contentWidth / 2 then fingerX = fingerX + 20 fingerY = (startY + fingerY) / 2 elseif from == "left" then fingerX = fingerX - 20 fingerY = (startY + fingerY) / 2 end if fingerX \< -1 \* display.contentWidth then fingerX = -1 \* display.contentWidth fingerY = startY mainShadow.isVisible = false curlShadow.isVisible = false newShadow.isVisible = false end if fingerX \> display.contentWidth then fingerX = display.contentWidth fingerY = startY mainShadow.isVisible = false curlShadow.isVisible = false newShadow.isVisible = false end end tempX = (fingerX + (display.contentWidth - fingerX)/2) maskRot = math.deg (math.atan2 (startY - fingerY, display.contentWidth - tempX)) card.maskRotation = maskRot / 6 card.maskX = tempX - display.contentWidth / 2 cardBack.rotation = maskRot / 3 cardBack.x = tempX cardBack.xReference = display.contentWidth/2 - tempX cardBack.maskRotation = maskRot / -6 cardBack.maskX = display.contentWidth / 2 - tempX mainShadow.rotation = maskRot / 3 mainShadow.x = tempX + 10 \* (fingerX / display.contentWidth) mainShadow.xReference = display.contentWidth/2 - tempX mainShadow.maskRotation = maskRot / -6 mainShadow.maskX = display.contentWidth / 2 - tempX - 10 \* (fingerX / display.contentWidth) curlShadow.rotation = maskRot / 6 curlShadow.x = tempX curlShadow.xScale = 1 - fingerX / display.contentWidth newShadow.rotation = maskRot / 6 newShadow.x = tempX newShadow.xScale = 1 - fingerX / display.contentWidth / 3 end
For example when I click on the image (anywhere) it starts to curl up from the right side but where does that logic come from?
I’m pretty sure it has to do with the variables maskRot and tempX but I’m note sure how I would change them so that I could curl from the left side instead.
Thanks in advance for your help!
Best regards,
Tomas