local w = display.contentWidth local h = display.contentHeight local background local playBlackSqr = {} local playRedSqr = {} --------------------------------------------------------------------------------- --displaySquares --------------------------------------------------------------------------------- local function displaySquares(params) local color,alpha = params.color, params.alpha local squares = {} for i = 1,19 do squares[i] = display.newRect(100, i\*50, 25, 25) squares[i]:setFillColor(color[1],color[2],color[3]) squares[i].alpha = alpha end return squares end --------------------------------------------------------------------------------- --startAnimations --------------------------------------------------------------------------------- local function startAnimations(blackSqr, redSqr) local startBlackSqr = {} local startRedSqr = {} for i = 1,19 do startBlackSqr[i] = transition.dissolve(blackSqr[i],redSqr[i],200,i\*700-500) startRedSqr[i] = transition.dissolve(redSqr[i],blackSqr[i],400,i\*700+1300) print(#startBlackSqr .. " #startBlackSqr " .. i) print(#startRedSqr .. " #startRedSqr " .. i) end return startBlackSqr, startRedSqr end -------------------------------------------------------------------------------- --background background = display.newRect( 0, 0, w, h ) background.color = { 255, 255, 255 } --squares blackSqr= displaySquares{color={0,0,0},alpha=1} redSqr= displaySquares{color={0,255,0},alpha=0} --startAnimations playBlackSqr, playRedSqr = startAnimations( blackSqr, redSqr )
When I run this it gives no errors but also fails to add new entries to the arrays startBlackSqr and startRedSqr on lines 30 and 31:
startBlackSqr[i] = transition.dissolve(blackSqr[i],redSqr[i],200,i*700-500)
startRedSqr[i] = transition.dissolve(redSqr[i],blackSqr[i],400,i*700+1300)
TIA for your help.