----------------------------------------------------------------------------------------- -- -- main.lua -- ----------------------------------------------------------------------------------------- -- Your code here display.setStatusBar(display.HiddenStatusBar) local widget = require "widget" local animationStatus = "resume" local syncSound = require "syncSound" -- Box transition sample --[[local box = display.newRect(0,0,100,100) box.x,box.y = 60,50 transition.to( box , { x = 260 , y = 300 , time = 3000 , transition = easing.continuousLoop , tag = "box" } ) transition.pause("box") local function pausebtnRelease(event) if animationStatus == "resume" then animationStatus = "pause" transition.pause("box") end return true end local function resumebtnRelease(event) if animationStatus == "pause" then animationStatus = "resume" transition.resume("box") end return true end]] -- Text transition local speak\_401 = display.newImageRect( "kAudio.png", 30, 30 ); speak\_401.x = 24; speak\_401.y = 180 speak\_401.alpha = 0 local kwk\_readMeFile = audio.loadSound( "thedream\_5.mp3" ) local s115textbody\_txt = { {start = 0, out = 654.088, dur = 0, name = "There"}, {start = 652.92, out = 1106.11, dur = 0, name = "once"}, {start = 1107.278, out = 1189.039, dur = 0, name = "was"}, {start = 1190.207, out = 1288.32, dur = 0, name = "a"}, {start = 1289.488, out = 1714.645, dur = 0, name = "man"}, {start = 1716.981, out = 2032.345, dur = 0, name = "called"}, {start = 2032.345, out = 2881.491, dur = 0, name = "Ahmad"}, {start = 2881.491, out = 3046.181, dur = 0, name = "who"}, {start = 3045.013, out = 3393.082, dur = 0, name = "lived"}, {start = 3393.082, out = 3622.013, dur = 0, name = "in"}, {start = 3622.013, out = 5214.016, dur = 0, name = "Baghdad."}, {start = 5214.016, out = 5363.522, dur = 0, name = "He"}, {start = 5363.522, out = 5515.364, dur = 0, name = "had", newline = true}, {start = 5515.364, out = 6269.901, dur = 0, name = "four"}, {start = 6269.901, out = 6912.309, dur = 0, name = "wonderful"}, {start = 6912.309, out = 7593.261, dur = 0, name = "children"}, {start = 7593.261, out = 7714.735, dur = 0, name = "and"}, {start = 7713.567, out = 7991.554, dur = 0, name = "a"}, {start = 7991.554, out = 8365.319, dur = 0, name = "loving"}, {start = 8365.319, out = 8852.381, dur = 0, name = "wife,"}, {start = 8851.213, out = 10598.562, dur = 0, name = "Amira."}, {start = 10598.562, out = 11641.599, dur = 0, name = "Together,"}, {start = 11641.599, out = 11945.283, dur = 0, name = "they", newline = true}, {start = 11945.283, out = 12306.199, dur = 0, name = "all"}, {start = 12306.199, out = 12595.867, dur = 0, name = "lived"}, {start = 12595.867, out = 12698.652, dur = 0, name = "in"}, {start = 12698.652, out = 12829.47, dur = 0, name = "a"}, {start = 12829.47, out = 13978.796, dur = 0, name = "broken-down"}, {start = 13978.796, out = 14403.953, dur = 0, name = "green"}, {start = 14405.121, out = 14952.92, dur = 0, name = "house"}, {start = 14952.92, out = 15249.596, dur = 0, name = "under"}, {start = 15249.596, out = 15417.79, dur = 0, name = "a"}, {start = 15417.79, out = 15911.86, dur = 0, name = "carob"}, {start = 15911.86, out = 17065.858, dur = 0, name = "tree."}, {start = 17064.69, out = 18147.439, dur = 0, name = "Everyday,", newline = true}, {start = 18147.439, out = 18692.902, dur = 0, name = "Ahmad"}, {start = 18692.902, out = 18938.185, dur = 0, name = "worked"}, {start = 18938.185, out = 19679.874, dur = 0, name = "long"}, {start = 19679.874, out = 19842.228, dur = 0, name = "and"}, {start = 19842.228, out = 20815.184, dur = 0, name = "hard,"}, {start = 20815.184, out = 21372.327, dur = 0, name = "digging"}, {start = 21372.327, out = 21929.47, dur = 0, name = "ditches"}, {start = 21929.47, out = 22063.792, dur = 0, name = "in"}, {start = 22063.792, out = 22268.194, dur = 0, name = "the"}, {start = 22268.194, out = 22678.167, dur = 0, name = "desert"}, {start = 22678.167, out = 23327.583, dur = 0, name = "soil."}, } local b\_s115textbody, s115textbody = syncSound.addSentence{ x = 39, y = 180, padding = 10, sentence=kwk\_readMeFile, sentenceDir="audio", line=s115textbody\_txt, button=speak\_401, font="CooperBlack", fontColor = {255, 255, 255}, fontSize = 24, fontColorHi = {254, 245, 3}, fadeDuration = 500, wordTouch = false, readDir="leftToRight"} timer.performWithDelay( 1000, function() syncSound.saySentence{sentence=kwk\_readMeFile,line=s115textbody\_txt, button=b\_s115textbody} end) local function pausebtnRelease(event) if animationStatus == "resume" then animationStatus = "pause" syncSound.pauseSenetnce() end return true end local function resumebtnRelease(event) if animationStatus == "pause" then animationStatus = "resume" syncSound.resumeSenetnce() end return true end local pausebtn = widget.newButton({ label = "Pause", fontSize = 30, onRelease = pausebtnRelease, }) pausebtn.x,pausebtn.y = display.contentCenterX , display.contentCenterY + 120 local resumebtn = widget.newButton({ label = "Resume", fontSize = 30, onRelease = resumebtnRelease, }) resumebtn.x,resumebtn.y = display.contentCenterX , pausebtn.y + 70