Page Curl

Page Curl

Page Curl will work with Ultimate config project and the other project config like New Universal project too. The sample project file is here.

this sample is made with ultimate config.

Prelaoding is off

You need to disable ‘preload pages’. This is necessay for page curl to work.

From Advnaced, Settings tab, check it off Preload pages

Or just remove the preloding codes from tmplt/components/page_common.lua. page_common_curl.lua is a reference file that disabled preloading.

Changing the tmplt files

From Project properties > General Tab, enable page curl checkbox

If you project setting is portrait, please use page_swipe_curl_portrait.lua

Flipping Audio (optional)

If you like to play audio while page is flipping. Please enable flip_audio and prepare your audio file.

tmplt/components/page_swipe_curl.lua

local flip_audio = false
local laserSound
--
if flip_audio then
  laserSound = audio.loadSound(_K.audioDir.."page-flip-02.wav")
end

_K.audioDir is build4/assets/audios

page-flip-02.wav is taken from a copyright free site.

Setting background image size (optional)

In page_swipe_curl.lua, you find the following section in the beginning. Please notice bgW, bgH are the width of background and the height of the background. The page curl area is based on these values. In some cases, you may want to change it.

{{#ultimate}}
-- local bgW, bgH = 1280/4, 1920/4                 --  layer.{{backLayer}}.width, layer.{{backLayer}}.height
local bgW, bgH = display.contentWidth, display.contentHeight
local pgX, pgY = _K.ultimatePosition(640, 960) --  layer.{{backLayer}}.x, layer.{{backLayer}}.y
local curlWidth = 400/4
{{/ultimate}}
{{^ultimate}}
local bgW, bgH = 1152, 2048
local pgX, pgY = 768,  1024
local curlWidth = 400
{{/ultimate}}

ultimate config

this first block is for ultimate config.

{{#ultimate}}
-- local bgW, bgH = 1280/4, 1920/4                 --  layer.{{backLayer}}.width, layer.{{backLayer}}.height
local bgW, bgH = display.contentWidth, display.contentHeight
local pgX, pgY = _K.ultimatePosition(640, 960) --  layer.{{backLayer}}.x, layer.{{backLayer}}.y
local curlWidth = 400/4
{{/ultimate}}

non ultimate config

{{^ultimate}}
local bgW, bgH = 1152, 2048
local pgX, pgY = 768,  1024
local curlWidth = 400
{{/ultimate}}

Debug mode

it shows grapping region. Please remove it if done testing

local debug = false