page 4
Page Curl
You find page_common_curl.lua and page_swipe_curl.lua in tmplt/components/pagexxx folder. These files are the substitutes for page_common.lua and page_swipe.lua. You can delete the default page_common.lua and page_swipe.lua and then rename page_common_curl.lua and page_swipe_curl.lua as page_common.lua and page_swipe.lua.
The original copies of page_common.lua and page_swipe.lua are page_common_original.lua and page_swipe_original.lua
If you like to specify the time duration of AutoPlay for each page, please add your timeTable in page_common.lua. Please check the page_common.lua in the sample project for example.
-
page_common_curl.lua with time table control
local timeTable = {en={}, jp={}} timeTable["en"][2] = 1000 timeTable["en"][3] = 2000 timeTable["jp"][2] = 3000 timeTable["jp"][3] = 4000 ... if timeTable ~=nil and timeTable[_K.lang] ~= nil then UI.allAudios.kAutoPlay = timeTable[_K.lang][curPage] end
You may add sound when page is curing. Please enable flip_audio as true and put your audio file in build4/assets/audios/ directory and set the audio file name to audio.loadSound function. This uses page-flip-02.wav for example.
-
page_swipe_curl.lua
local flip_audio = false local laserSound -- if flip_audio then laserSound = audio.loadSound(_K.audioDir.."page-flip-02.wav") end
Another example of Page Curl is here
Note
page_swipe_curl.lua has the interface to call page curl effect
UI.autoPlayCurl = function(act_autoPlay)
if UI.curPage < UI.numPages then
back.angle_radians = math.pi/10
back.edge_x, back.edge_y = 0.9, 0.5
Grabbed({target=back, dir="right"})
if flip_audio then
local laserChannel = audio.play( laserSound )
end
transition.to(back, {edge_x=0, time=1000, transition=easing.inOutSine, onComplete = act_autoPlay})
end
end
When auto play is executed, it calls UI.autoPlayCurl in page_common_curl.lua
if (UI.allAudios.kAutoPlay > _K.kAutoPlay*1000) then
_K.timerStash.timer_AP = timer.performWithDelay(
UI.allAudios.kAutoPlay + _Delay ,
function()
UI.autoPlayCurl(act_autoPlay)
end , 1 )
else
_K.timerStash.timer_AP = timer.performWithDelay( _K.kAutoPlay*1000,
function()
UI.autoPlayCurl(act_autoPlay)
end , 1 )
end
...