Hi,
Does anyone have tips on the best way to control timing of png fades synched with audio?
Transitions are happening way too fast and I can’t find a way to control them.
Goal, for an ordered set of 50 pngs:
-
fade-in png
-
play png’s audio
-
fade-out png
-
pause briefly before moving on to next loop.
Here’s what I have now. Any feedback and suggestions will be greatly appreciated. Thank you!
[lua]
–**************************************
–******* SHOW/PLAY/HIDE EACH PNG **
–**************************************
function runIntro ()
--first fade happens too fast
--timer.performWithDelay for runIntro doesn’t help
–goal:
–rotate through numTotal - ordered set of 50 pngs (now testing w/2) - fadein/play audio/fadeout
– i = numTotal; j = localGroup.numChildren
for i = 1, numTotal do
print("i = "… i); --check ‘i’
–search localGroup
for j = 1, localGroup.numChildren do
–locate the current ‘i’ png match
if (localGroup[j].order == i) then
–grab current audio file name
currAudio = localGroup[j].answer;
–after fade in (transition below) complete, play sound and fade out ‘i’ png
function playTheAudio ()
audio.play(currAudio)
transition.to(localGroup[j], {time=1000, alpha=0});
–return true;–fades both png#1 and png#2 in & out, only plays second sound
end
–fade in ‘i’ png
transition.to(localGroup[j], {time=3000, alpha=1, onComplete=playTheAudio});
–return true;–stops after png#1, no png#2 - just ends here
end
–return true;–never gets past assigning i = i
end
print(“made it through first pass”);
–return true;–only gets through png#1, prints statement ^ but never assigns i = 2
end
–return true;–fades both pngs in & out, only plays second sound
end
–tmr = timer.performWithDelay( 1500, runIntro, 1 )–doesn’t help
[/lua]