Display lines of transition.fadeIn text in sequence

Hi,

I want to display 3 of lines of text and if it’s a certain time display the 4th.

My code looks like this

local firstLine = display.newText("first line",background.x,40, "sega.ttf", 25) local secondLine = display.newText("second line",background.x,90, "sega.ttf", 25) local thirdline = display.newText("third line",background.x,135, "sega.ttf", 25) local fourthLine = display.newText("4th line",background.x,200, "sega.ttf", 25) transition.fadeIn( firstLine, { time=2000 } ) transition.fadeIn( secondLine, { delay=2000,time=1000 } ) transition.fadeIn( thirdline, { delay=3000,time=1000 } ) if date.hour \>= 1 and date.hour \<18 then &nbsp; &nbsp; &nbsp; &nbsp; transition.fadeIn( fourthLine, { delay=8000,time=1000 } )

The problem is the 4th line is displayed immediately. I’m thinking I need to create functions for each line and once the first completes move onto the second or something like this? I saw transition.to but not sure if that is the right direction.

Any advice would be much appreciated :slight_smile:

Thanks,

D.

set all alphas to 0 before the calls to fadein

I updated my code following roaming gamer’s advice 

local background = display.newImageRect( "background.png", display.actualContentWidth, display.actualContentHeight) local x =1 background.x = display.contentCenterX background.y = display.contentCenterY print (background.x) local firstLine = display.newText("first line",background.x,150, native.systemFont,100) local secondLine = display.newText("second line",background.x,250, native.systemFont,100) local thirdline = display.newText("third line",background.x,350, native.systemFont,100) firstLine.alpha = 0 secondLine.alpha = 0 thirdline.alpha = 0 transition.fadeIn( firstLine, { time=2000 } ) transition.fadeIn( secondLine, { delay=2000,time=1000 } ) transition.fadeIn( thirdline, { delay=3000,time=1000 } ) if x \<10 then local fourthLine = display.newText("4th line",background.x,550, native.systemFont,100) fourthLine.alpha = 0 transition.fadeIn( fourthLine, { delay=8000,time=1000 } ) end

and sure enough the 4th line is displayed properly.

Many thanks.

set all alphas to 0 before the calls to fadein

I updated my code following roaming gamer’s advice 

local background = display.newImageRect( "background.png", display.actualContentWidth, display.actualContentHeight) local x =1 background.x = display.contentCenterX background.y = display.contentCenterY print (background.x) local firstLine = display.newText("first line",background.x,150, native.systemFont,100) local secondLine = display.newText("second line",background.x,250, native.systemFont,100) local thirdline = display.newText("third line",background.x,350, native.systemFont,100) firstLine.alpha = 0 secondLine.alpha = 0 thirdline.alpha = 0 transition.fadeIn( firstLine, { time=2000 } ) transition.fadeIn( secondLine, { delay=2000,time=1000 } ) transition.fadeIn( thirdline, { delay=3000,time=1000 } ) if x \<10 then local fourthLine = display.newText("4th line",background.x,550, native.systemFont,100) fourthLine.alpha = 0 transition.fadeIn( fourthLine, { delay=8000,time=1000 } ) end

and sure enough the 4th line is displayed properly.

Many thanks.