-------------------------------------------------------------------------------- -- Copyright (c) 2009 Andreas Rozek -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"),to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is fur- -- nished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA- -- BILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- Additionally, any modifications to the original Software must be clearly -- marked in a way, that the original author will never be considered as the -- author of these modifications! -------------------------------------------------------------------------------- StageWidth,StageHeight = display.stageWidth,display.stageHeight; -------------------------------------------------------------------------------- -- Display Elements -- -------------------------------------------------------------------------------- Hello = display.newText("Hello", 0,0, nil, 48); Hello:setReferencePoint(display.CenterReferencePoint); Hello.x = StageWidth/2; Hello.y = StageHeight/2-50-80; Hello:setTextColor(242,211,24); Hello:scale(0.5,0.5); -- never try to animate the font size! Hello.alpha = 0; Hello.isVisible = false; -- might speed up screen refreshes World = display.newText("World!", 0,0, nil, 48); World:setReferencePoint(display.CenterReferencePoint); World.x = StageWidth/2; World.y = StageHeight/2-50+80; World:setTextColor(242,211,24); World:scale(0.5,0.5); -- never try to animate the font size! World.alpha = 0; World.isVisible = false; -- might speed up screen refreshes Welcome = display.newText("Welcome...", 0,0, nil, 48); Welcome:setReferencePoint(display.CenterReferencePoint); Welcome.x = StageWidth/2; Welcome.y = StageHeight/2-50; Welcome:setTextColor(242,211,24); Welcome:scale(0.5,0.5); -- never try to animate the font size! Welcome.alpha = 0; Welcome.isVisible = false; -- might speed up screen refreshes CoronaLogo = display.newImage("Corona.png" -- system.pathForFile("Corona.png",system.ResourcesDirectory) ); CoronaLogo:setReferencePoint(display.BottomCenterReferencePoint); CoronaLogo.x = StageWidth/2; CoronaLogo.y = StageHeight; local ScaleFactor = StageWidth/57; CoronaLogo:scale(ScaleFactor,ScaleFactor); CoronaLogo.isVisible = false; -- might speed up screen refreshes Corona = display.newText("Corona", 0,0, nil, 52); Corona:setReferencePoint(display.CenterReferencePoint); Corona.x = StageWidth/2; Corona.y = StageHeight/2-150; Corona:setTextColor(242,211,24); Corona.isVisible = false; -- might speed up screen refreshes iPhone = display.newText("iPhone", 0,0, nil, 48); iPhone:setReferencePoint(display.CenterReferencePoint); iPhone.x = StageWidth/2; iPhone.y = StageHeight/2-50-80; iPhone:setTextColor(24,132,242); iPhone:scale(0.5,0.5); -- never try to animate the font size! iPhone.alpha = 0; iPhone.isVisible = false; -- might speed up screen refreshes Development = display.newText("Development", 0,0, nil, 48); Development:setReferencePoint(display.CenterReferencePoint); Development.x = StageWidth/2; Development.y = StageHeight/2-50+80; Development:setTextColor(24,132,242); Development:scale(0.5,0.5); -- never try to animate the font size! Development.alpha = 0; Development.isVisible = false; -- might speed up screen refreshes Using = display.newText("using...", 0,0, nil, 48); Using:setReferencePoint(display.CenterReferencePoint); Using.x = StageWidth/2; Using.y = StageHeight/2-50; Using:setTextColor(24,132,242); Using:scale(0.5,0.5); -- never try to animate the font size! Using.alpha = 0; Using.isVisible = false; -- might speed up screen refreshes LuaLogo = display.newImage("Lua.png" -- system.pathForFile("Lua.png",system.ResourcesDirectory) ); LuaLogo:setReferencePoint(display.CenterReferencePoint); LuaLogo.x = StageWidth/2; LuaLogo.y = StageHeight/2-20; ScaleFactor = StageWidth/128; LuaLogo:scale(2,2); LuaLogo.isVisible = false; -- might speed up screen refreshes Design = display.newText("Design", 0,0, nil, 48); Design:setReferencePoint(display.CenterReferencePoint); Design.x = StageWidth/2; Design.y = StageHeight/2-50-80; Design:setTextColor(242,211,24); Design:scale(0.5,0.5); -- never try to animate the font size! Design.alpha = 0; Design.isVisible = false; -- might speed up screen refreshes Develop = display.newText("Develop", 0,0, nil, 48); Develop:setReferencePoint(display.CenterReferencePoint); Develop.x = StageWidth/2; Develop.y = StageHeight/2-50; Develop:setTextColor(242,211,24); Develop:scale(0.5,0.5); -- never try to animate the font size! Develop.alpha = 0; Develop.isVisible = false; -- might speed up screen refreshes Distribute = display.newText("Distribute", 0,0, nil, 48); Distribute:setReferencePoint(display.CenterReferencePoint); Distribute.x = StageWidth/2; Distribute.y = StageHeight/2-50+80; Distribute:setTextColor(242,211,24); Distribute:scale(0.5,0.5); -- never try to animate the font size! Distribute.alpha = 0; Distribute.isVisible = false; -- might speed up screen refreshes With = display.newText("with", 0,0, nil, 48); With:setReferencePoint(display.CenterReferencePoint); With.x = StageWidth/2; With.y = StageHeight/2-20-80; With:setTextColor(121,199,8); With.isVisible = false; -- might speed up screen refreshes Ease = display.newText("ease!", 0,0, nil, 48); Ease:setReferencePoint(display.CenterReferencePoint); Ease.x = StageWidth/2; Ease.y = StageHeight/2-20; Ease:setTextColor(121,199,8); Ease:scale(0.5,0.5); -- never try to animate the font size! Ease.alpha = 0; Ease.isVisible = false; -- might speed up screen refreshes AndEverything = display.newGroup(); local And = display.newText("...and", 0,0, nil, 48); And:setReferencePoint(display.CenterReferencePoint); And.x = StageWidth/2; And.y = 20; And:setTextColor(222,222,222); AndEverything:insert(And); local Everything = display.newText("everything", 0,0, nil, 48); Everything:setReferencePoint(display.CenterReferencePoint); Everything.x = StageWidth/2; Everything.y = 70; Everything:setTextColor(222,222,222); AndEverything:insert(Everything); AndEverything:setReferencePoint(display.CenterReferencePoint); AndEverything.x = StageWidth/2; AndEverything.y = StageHeight/2-50-80; AndEverything:scale(0.5,0.5); -- never try to animate the font size! AndEverything.alpha = 0; AndEverything.isVisible = false; -- might speed up screen refreshes AlsoForThe = display.newText("also for the...", 0,0, nil, 48); AlsoForThe:setReferencePoint(display.CenterReferencePoint); AlsoForThe.x = StageWidth/2; AlsoForThe.y = StageHeight/2-50+80; AlsoForThe:setTextColor(222,222,222); AlsoForThe:scale(0.5,0.5); -- never try to animate the font size! AlsoForThe.alpha = 0; AlsoForThe.isVisible = false; -- might speed up screen refreshes iPadImage = display.newImage("iPad.png" -- system.pathForFile("iPad.png",system.ResourcesDirectory) ); iPadImage:setReferencePoint(display.BottomCenterReferencePoint); iPadImage.x = StageWidth/2; iPadImage.y = StageHeight-40; iPadImage:scale(0.7,0.7); iPadImage.isVisible = false; -- might speed up screen refreshes iPad = display.newText("iPad", 0,0, nil, 48); iPad:setReferencePoint(display.TopCenterReferencePoint); iPad.x = StageWidth/2; iPad.y = 40; iPad:setTextColor(222,222,222); iPad.isVisible = false; -- might speed up screen refreshes -------------------------------------------------------------------------------- -- Animation Functions -- -------------------------------------------------------------------------------- function animateHello () Hello.x = StageWidth/2; Hello.y = StageHeight/2-50-80; Hello:scale(0.5,0.5); Hello.alpha = 0; Hello.isVisible = true; transition.to(Hello, { delay = 1000, time = 2800, y = StageHeight/2-50-40, xScale = 1, yScale = 1, alpha = 1, onComplete = animateWorld }); end; function animateWorld () World.x = StageWidth/2; World.y = StageHeight/2-50+80; World:scale(0.5,0.5); World.alpha = 0; World.isVisible = true; transition.to(World, { time = 2500, y = StageHeight/2-50+20, xScale = 1, yScale = 1, alpha = 1, onComplete = animateWelcome }); end; function animateWelcome () Hello.isVisible = false; World.isVisible = false; Welcome.x = StageWidth/2; Welcome.y = StageHeight/2-50; Welcome:scale(0.5,0.5); Welcome.alpha = 0; Welcome.isVisible = true; transition.to(Welcome, { time = 3000, xScale = 1, yScale = 1, alpha = 1, onComplete = waitForCorona }); end; function waitForCorona () transition.to(Welcome, {time = 1000, onComplete = animateCorona}) end; function animateCorona () Welcome.isVisible = false; CoronaLogo.isVisible = true; Corona.isVisible = true; transition.to(Corona, {time = 8800, onComplete = animateIPhone}) end; function animateIPhone () CoronaLogo.isVisible = false; Corona.isVisible = false; iPhone.x = StageWidth/2; iPhone.y = StageHeight/2-50-80; iPhone:scale(0.5,0.5); iPhone.alpha = 0; iPhone.isVisible = true; transition.to(iPhone, { time = 2000, y = StageHeight/2-50-40, xScale = 1, yScale = 1, alpha = 1, onComplete = animateDevelopment }); end; function animateDevelopment () Development.x = StageWidth/2; Development.y = StageHeight/2-50+80; Development:scale(0.5,0.5); Development.alpha = 0; Development.isVisible = true; transition.to(Development, { time = 2000, y = StageHeight/2-50+20, xScale = 1, yScale = 1, alpha = 1, onComplete = animateUsing }); end; function animateUsing () iPhone.isVisible = false; Development.isVisible = false; Using.x = StageWidth/2; Using.y = StageHeight/2-50; Using:scale(0.5,0.5); Using.alpha = 0; Using.isVisible = true; transition.to(Using, { time = 3000, xScale = 1, yScale = 1, alpha = 1, onComplete = waitForLua }); end; function waitForLua () transition.to(Using, {time = 1000, onComplete = animateLua}) end; function animateLua () Using.isVisible = false; LuaLogo.isVisible = true; transition.to(LuaLogo, {time = 9000, onComplete = animateDesign}) end; function animateDesign () LuaLogo.isVisible = false; Design.x = StageWidth/2; Design.y = StageHeight/2-50-80; Design:scale(0.5,0.5); Design.alpha = 0; Design.isVisible = true; transition.to(Design, { time = 2000, xScale = 1, yScale = 1, alpha = 1, onComplete = animateDevelop }); end; function animateDevelop () Develop.x = StageWidth/2; Develop.y = StageHeight/2-50; Develop:scale(0.5,0.5); Develop.alpha = 0; Develop.isVisible = true; transition.to(Develop, { time = 2000, xScale = 1, yScale = 1, alpha = 1, onComplete = animateDistribute }); end; function animateDistribute () Distribute.x = StageWidth/2; Distribute.y = StageHeight/2-50+80; Distribute:scale(0.5,0.5); Distribute.alpha = 0; Distribute.isVisible = true; transition.to(Distribute, { time = 3000, xScale = 1, yScale = 1, alpha = 1, onComplete = waitForWith }); end; function waitForWith () transition.to(Distribute, {time = 1000, onComplete = animateWith}) end; function animateWith () Design.isVisible = false; Develop.isVisible = false; Distribute.isVisible = false; With.isVisible = true; transition.to(With, {time = 200, onComplete = animateEase}) end; function animateEase () Ease.x = StageWidth/2; Ease.y = StageHeight/2-20; Ease:scale(0.5,0.5); Ease.alpha = 0; Ease.isVisible = true; transition.to(Ease, { time = 3000, xScale = 1, yScale = 1, alpha = 1, onComplete = waitForEverything }); end; function waitForEverything () transition.to(Ease, {time = 1500, onComplete = animateEverything}) end; function animateEverything () With.isVisible = false; Ease.isVisible = false; AndEverything.x = StageWidth/2; AndEverything.y = StageHeight/2-50-80; AndEverything:scale(0.5,0.5); AndEverything.alpha = 0; AndEverything.isVisible = true; transition.to(AndEverything, { time = 3500, y = StageHeight/2-50-40, xScale = 1, yScale = 1, alpha = 1, onComplete = animateAlsoForThe }); end; function animateAlsoForThe () AlsoForThe.x = StageWidth/2; AlsoForThe.y = StageHeight/2-50+80; AlsoForThe:scale(0.5,0.5); AlsoForThe.alpha = 0; AlsoForThe.isVisible = true; transition.to(AlsoForThe, { time = 2000, y = StageHeight/2-50+45, xScale = 1, yScale = 1, alpha = 1, onComplete = animateIPad }); end; function animateIPad () AndEverything.isVisible = false; AlsoForThe.isVisible = false; iPad.isVisible = true; iPadImage.isVisible = true; end; -------------------------------------------------------------------------------- -- Alert Handling Functions -- -------------------------------------------------------------------------------- function waitForAlert () transition.to(iPad, {time = 81000, onComplete = displayAlert}) end; function displayAlert () system.setIdleTimer(true); native.showAlert( "Welcome Corona!", "Do you want to see the animation again?", {"Show Again", "Dismiss"}, onAlert ); end; function onAlert (Event) if (Event.action == "clicked") then if (Event.index == 1) then iPad.isVisible = false; iPadImage.isVisible = false; showAnimation(); else os.exit(0); end; end; end -------------------------------------------------------------------------------- -- Let's Start! -- -------------------------------------------------------------------------------- function showAnimation () system.setIdleTimer(false); media.playSound("Zarathustra.mp3" -- system.pathForFile("Zarathustra.mp3",system.ResourcesDirectory) ); waitForAlert(); animateHello(); end; showAnimation();