整理代码

This commit is contained in:
MrZ626
2021-04-27 21:00:30 +08:00
parent c21a5afb61
commit be769a3617
11 changed files with 105 additions and 122 deletions

View File

@@ -5,16 +5,15 @@ local rnd=math.random
local scene={} local scene={}
local t1,t2,animateType local t1,t2,animeType
function scene.sceneInit() function scene.sceneInit()
BG.set() BG.set()
t1,t2=0,0--Timer t1,t2=0,0--Timer
animateType={rnd(5),rnd(5),rnd(5),rnd(5),rnd(5),rnd(5),rnd(5),rnd(5)}--Random animation type animeType={}for i=1,8 do animeType[i]=rnd(5)end--Random animation type
end end
function scene.mouseDown(_,_,k) function scene.mouseDown(_,_,k)
if k~=2 then
if newVersionLaunch then if newVersionLaunch then
SCN.push(SETTING.simpMode and"main_simple"or"main") SCN.push(SETTING.simpMode and"main_simple"or"main")
SCN.swapTo("history","fade") SCN.swapTo("history","fade")
@@ -22,9 +21,6 @@ function scene.mouseDown(_,_,k)
else else
SCN.go(SETTING.simpMode and"main_simple"or"main") SCN.go(SETTING.simpMode and"main_simple"or"main")
end end
else
SCN.swapTo("quit","slowFade")
end
end end
function scene.touchDown() function scene.touchDown()
scene.mouseDown() scene.mouseDown()
@@ -39,28 +35,15 @@ function scene.keyDown(key)
end end
function scene.update() function scene.update()
t1=t1+1 t1,t2=t1+1,t2+1
t2=t2+1
end end
local titleTransform={ local titleTransform={
function(t) function(t)gc.translate(0,max(50-t,0)^2/25)end,
gc.translate(0,max(50-t,0)^2/25) function(t)gc.translate(0,-max(50-t,0)^2/25)end,
end, function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)end,
function(t) function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)end,
gc.translate(0,-max(50-t,0)^2/25) function(t)gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)end,
end,
function(t,i)
local d=max(50-t,0)
gc.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)
end,
function(t,i)
local d=max(50-t,0)
gc.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)
end,
function(t)
gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)
end,
} }
function scene.draw() function scene.draw()
local T=(t1+110)%300 local T=(t1+110)%300
@@ -77,7 +60,7 @@ function scene.draw()
if t>0 then if t>0 then
gc.push("transform") gc.push("transform")
gc.setColor(1,1,1,min(t*.025,1)) gc.setColor(1,1,1,min(t*.025,1))
titleTransform[animateType[i]](t,i) titleTransform[animeType[i]](t,i)
local dt=(t1+62-5*i)%300 local dt=(t1+62-5*i)%300
if dt<20 then if dt<20 then
gc.translate(0,math.abs(10-dt)-10) gc.translate(0,math.abs(10-dt)-10)