Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
orientation = {
default = "landscapeRight",
supported = { "landscapeRight", }
}
----------------------------------------------------------------------------------
-- Autohide | Autoscroll menu for Corona SDK (c) 2014 - Eduardo Luis Arana
-- Documento: Main
----------------------------------------------------------------------------------
display.setStatusBar( display.HiddenStatusBar )
---let's paint the background
local background = display.newRect (0,0, display.contentWidth * 2, display.contentHeight * 2)
background:setFillColor( 255,255,255 )
local pintafondoboton = { type="gradient", color1={ .102, .682, .871 }, color2={ .120, .592, .780 }, "down" }
local grupogeneral = display.newGroup()
local grupobotones = display.newGroup()
local grupomenu = display.newGroup()
local barrasuperior = display.newRect(0, 0, display.contentWidth * 2+10, 60)
barrasuperior.strokeWidth = 0
barrasuperior:setFillColor(pintafondoboton)
grupogeneral:insert( barrasuperior )
local logotexto = display.newText("AUTOSCROLLING MENU FOR CORONA SDK MADE BY EDU ARANA | www.arananet.net", 0, 0, native.systemFont, 10)
logotexto:translate( 270, 15 )
logotexto:setFillColor( 255,255,255 )
grupogeneral:insert( logotexto )
---------------------------MENU APP INICIO---------------------------------------------
---background menu
local fondomenu = display.newRect(0, 0, 58, 60)
fondomenu.strokeWidth = 0
fondomenu:setFillColor(0,0,0)
fondomenu.alpha=0
grupobotones:insert( fondomenu )
local fondomenu1 = display.newRect(0, 170, 250, 250)
fondomenu1.strokeWidth = 0
fondomenu1:setFillColor(.199, .199, .199)
fondomenu1.alpha=0
grupomenu:insert( fondomenu1 )
local fondomenu5 = display.newRect(0, 170, 65, 250)
fondomenu5.strokeWidth = 0
fondomenu5:setFillColor(.267, .267, .267)
fondomenu5.alpha=1
grupomenu:insert( fondomenu5 )
------Open icon (calls the menu)
local iconomenu = display.newImage( "images/menu.png" )
iconomenu:translate( 14, 15 )
iconomenu.alpha=1
grupobotones:insert( iconomenu )
local quitaiconomenu = display.newImage( "images/menu.png" )
quitaiconomenu:translate( 14, 15 )
quitaiconomenu.alpha=0
grupobotones:insert( quitaiconomenu )
---color squares
local flag1menu = display.newRect(10, 63, 40, 30 )
flag1menu.name = "flag1menu"
flag1menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag1menu )
local flag2menu = display.newRect(10, 94, 40, 30 )
flag2menu.name = "flag2menu"
flag2menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag2menu )
local flag3menu = display.newRect(10, 125, 40, 30 )
flag3menu.name = "flag3menu"
flag3menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag3menu )
local flag4menu = display.newRect(10, 156, 40, 30 )
flag4menu.name = "flag4menu"
flag4menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag4menu )
local flag5menu = display.newRect(10, 187, 40, 30 )
flag5menu.name = "flag5menu"
flag5menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag5menu )
local flag6menu = display.newRect(10, 218, 40, 30 )
flag6menu.name = "flag6menu"
flag6menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag6menu )
local flag7menu = display.newRect(10, 249, 40, 30 )
flag7menu.name = "flag6menu"
flag7menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag7menu )
local flag8menu = display.newRect(10, 280.1, 40, 30 )
flag8menu.name = "flag6menu"
flag8menu:setFillColor(.200, .475, .906)
grupomenu:insert( flag8menu )
local flagnumber1 = display.newText("1", 0, 0, native.systemFont, 25)
flagnumber1:translate( 15, 63 )
grupomenu:insert( flagnumber1 )
local flagnumber2 = display.newText("2", 0, 0, native.systemFont, 25)
flagnumber2:translate( 15, 94 )
grupomenu:insert( flagnumber2 )
local flagnumber3 = display.newText("3", 0, 0, native.systemFont, 25)
flagnumber3:translate( 15, 124 )
grupomenu:insert( flagnumber3 )
local flagnumber4 = display.newText("4", 0, 0, native.systemFont, 25)
flagnumber4:translate( 14, 156 )
grupomenu:insert( flagnumber4 )
local flagnumber5 = display.newText("5", 0, 0, native.systemFont, 25)
flagnumber5:translate( 15, 186 )
grupomenu:insert( flagnumber5 )
local flagnumber6 = display.newText("6", 0, 0, native.systemFont, 25)
flagnumber6:translate( 15, 217 )
grupomenu:insert( flagnumber6 )
local flagnumber7 = display.newText("7", 0, 0, native.systemFont, 25)
flagnumber7:translate( 15, 249 )
grupomenu:insert( flagnumber7 )
local flagnumber9 = display.newText("8", 0, 0, native.systemFont, 25)
flagnumber9:translate( 15, 279 )
grupomenu:insert( flagnumber9 )
local menuitem1 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem1:translate( 80, 63 )
menuitem1:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem1 )
local menuitem2 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem2:translate( 80, 93 )
menuitem2:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem2 )
local menuitem3 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem3:translate( 80, 123 )
menuitem3:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem3 )
local menuitem4 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem4:translate( 80, 155 )
menuitem4:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem4 )
local menuitem5 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem5:translate( 80, 187 )
menuitem5:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem5 )
local menuitem6 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem6:translate( 80, 218 )
menuitem6:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem6 )
local menuitem7 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem7:translate( 78, 248 )
menuitem7:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem7 )
local menuitem8 = display.newText("Item menu", 0, 0, native.systemFont, 13)
menuitem8:translate( 78, 279 )
menuitem8:setFillColor( 255, 255, 255 )
grupomenu:insert( menuitem8 )
local fondomenu2 = display.newRect(0, 39, 250, 19)
fondomenu2.strokeWidth = 0
fondomenu2:setFillColor(.267, .267, .267)
fondomenu2.alpha=1
grupomenu:insert( fondomenu2 )
--Main menu text
local cabtextmenu = display.newText("Main Menu", 0, 0, native.systemFont, 11)
cabtextmenu:translate( 80, 39 )
cabtextmenu:setFillColor( 255, 255, 255 )
grupomenu:insert( cabtextmenu )
--hidding the menu
grupomenu.alpha=0
grupomenu.x=-100
---menu functions
---show menu
function muestramenu()
fondomenu.alpha=0.2
fondomenu1.alpha=0.7
iconomenu.alpha=0
iconomenu.x=-100
quitaiconomenu.alpha=1
quitaiconomenu.x = 14
grupomenu.alpha=1
fondomenu2.alpha=1
cabtextmenu.x=80
--speed transition to the right >>>>
transition.to( grupomenu, { time=500, x=(0)} )
end
iconomenu:addEventListener("tap", muestramenu)
---hide menu
function ocultamenu()
fondomenu.alpha=0
fondomenu1.alpha=0
iconomenu.alpha=1
iconomenu.x=14
quitaiconomenu.alpha=2
quitaiconomenu.x= -100
fondomenu2.alpha=0
cabtextmenu.x=-100
transition.to( grupomenu, { time=500, x=(-100)} )
end
quitaiconomenu:addEventListener("tap", ocultamenu)
---------------------------MENU APP FIN---------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.