From 04873c6ba7fd7e12a05dbc8aec1d7403f3de08c1 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Mon, 2 Oct 2023 09:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=95=8C=E9=9D=A2=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E7=9E=AC=E9=97=B4=E5=BC=B9=E5=87=BA=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4=E7=94=A8=E6=88=B7=E5=BF=83=E8=84=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scene/error.lua | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/assets/scene/error.lua b/assets/scene/error.lua index a01c1d06..8d395eee 100644 --- a/assets/scene/error.lua +++ b/assets/scene/error.lua @@ -1,6 +1,7 @@ -- A macOS-style error scene -local time,err,img +local time=0 +local err,img local imgW,imgH local texts={ "Techmino ran into a problem and needs to restart. You can send the error log to the developers.", @@ -40,11 +41,13 @@ function scene.keyDown(key,isRep) end function scene.update(dt) - if not img and time<5 then + if time<5 then time=time+dt - img=err.shot - if img then - imgW,imgH=img:getWidth(),img:getHeight() + if not img then + img=err.shot + if img then + imgW,imgH=img:getWidth(),img:getHeight() + end end end end @@ -85,14 +88,19 @@ function scene.draw() -- Screenshot if img then GC.replaceTransform(SCR.xOy_ur) - GC.setColor(1,1,1,.26) - GC.draw(img,0,0,nil,16*36/imgW,9*36/imgH,imgW,0) + local t=math.max(time-.26,0)*.626 + t=t<.5 and 4*t^3 or 1-4*(1-t)^3 -- EaseInOutCubic + t=MATH.clamp(t,0,1) + GC.setColor(1,1,1,MATH.lerp(1,.355,t)) + local kx=MATH.lerp(SCR.w/SCR.k,16*36,t)/imgW + local ky=MATH.lerp(SCR.h/SCR.k,9*36,t)/imgH + GC.draw(img,0,0,nil,kx,ky,imgW,0) end end scene.widgetList={ - {type='button',pos={.5,1},x=-130,y=-100,w=220,h=100,fontSize=75,text=CHAR.icon.console,code=WIDGET.c_goScn'_console'}, - {type='button',pos={.5,1},x=130,y=-100,w=220,h=100,fontSize=70,text=CHAR.icon.cross_big,code=WIDGET.c_pressKey'escape'}, + {type='button',pos={.5,1},x=-130,y=-100,w=220,h=100,fontSize=75,text=CHAR.icon.console,code=WIDGET.c_goScn'_console',visibleTick=function() return time>1 end}, + {type='button',pos={.5,1},x=130,y=-100,w=220,h=100,fontSize=70,text=CHAR.icon.cross_big,code=WIDGET.c_pressKey'escape',visibleTick=function() return time>1 end}, } return scene