00x-M0x

overlay_show.lua
local composer = require("composer") _K.curPage = UI.curPage _K.curUI = UI local overlays = {} overlays[1] = {} overlays[2] = {target = layer.photo, video = layer.video, icon=nil} overlays[3] = {target = layer.squirrellBg, video =nil, icon="funIcon"} local target = overlays[_K.curPage].target local video = overlays[_K.curPage].video local icon = overlays[_K.curPage].icon _K.showOverlay = function () composer.showOverlay("views.page012Scene") -- overlayed icons Runtime:dispatchEvent( { name = "overlay_init", target = target, icon=icon} ) end _K.showOverlay() -------------------- if _K.closeVideo then Runtime:removeEventListener("closeVideo", _K.closeVideo) end _K.closeVideo = function() print("closeVideo") if video then video.x = video.oriX video.y = video.oriY if _K.gt.linear_video then _K.gt.linear_video:pause() end end end Runtime:addEventListener("closeVideo", _K.closeVideo)
storyboard_show.lua
receives “showStoryboard” runtime event from the overlayed “story” button that sends the event with storyboard_play.lua
local storyboards = {} storyboards[1] = nil storyboards[2] = {dir="lib/spring01", file="spring01.storyboarder"} _K.showStoryboard = function() local composer = require("composer") composer.hideOverlay() -- page012Scene -- if _K.storyboardState == "pause" then _K.storyboardState = nil else _K.storyboardIndex = 1 end -- local sceneGroup = _K.curUI.scene.view local layer = _K.curUI.layer -- sceneGroup.alpha = 0.01 if layer.video then layer.video.x = layer.video.oriX layer.video.y = layer.video.oriY end -- _K.storyboardDir = storyboards[_K.curPage].dir _K.storyboardFile = storyboards[_K.curPage].file -- composer.showOverlay("views.page011Scene") -- viewer -- if layer.video and _K.gt.linear_video then _K.gt.linear_video:pause() end end Runtime:addEventListener("showStoryboard", _K.showStoryboard)
stroyboard_hide.lua
Runtime:removeEventListener("showStoryboard", _K.showStoryboard)
M1_play_video.lua
pauses and hides the viewer of storyboard and shows M1 (sceneGroup.alpha = 1) with the overlayed buttons of page012Scene. It also plays the liner_video animation to bring the native web view to show the page of Instagram.
local composer = require("composer") local _AC = require("commands.kwik.actionCommand") if _K.storyboardIndex ==3 then -- _AC.Layer:frontBack(layer.video, true, Layer) _AC.Animation:playAnimation("linear_video") sceneGroup.alpha = 1 Runtime:dispatchEvent( { name = "storyboard", command="pause", index=_K.storyboardIndex} ) composer.hideOverlay() -- view11Scene storyboard _K.showOverlay() -- view12Scene overlay Runtime:dispatchEvent( { name = "show_closeVideo"} ) end