wing背景优化(水晶比例设计:C29H25N3O5)

This commit is contained in:
MrZ626
2021-10-24 04:31:05 +08:00
parent 0278a3ad47
commit 716c44746b

View File

@@ -2,39 +2,36 @@
local gc=love.graphics local gc=love.graphics
local rnd=math.random local rnd=math.random
local back={} local back={}
local crystal_img,crystals
local wingColor={ local wingColor={
{.3,.9,.9,.2}, {.3,.8,.9,.3},
{.5,1.,.5,.2}, {.5,1.,.5,.3},
{.9,.9,.3,.2}, {.9,.9,.3,.3},
{1.,.7,.3,.2}, {1.,.7,.3,.3},
{1.,.5,.5,.2}, {1.,.5,.7,.3},
{.7,.3,1.,.2}, {.7,.3,1.,.3},
{.5,.5,1.,.2}, {.5,.5,1.,.3},
{.3,.9,.9,.2}, {.3,.8,.9,.3},
} }
local bar,crystal local wingHeight={.41,.42,.43,.44,.45,.46,.47,.48}
local W,H
function back.init() function back.init()
bar=gc.newCanvas(41,1) crystal_img=GC.DO{42,118,
gc.setCanvas(bar) {'setCL',.93,.93,.93},
gc.push('transform') {'fPoly',21,0,0,29,21,40},
gc.origin() {'setCL',.6,.6,.6},
for x=0,20 do {'fPoly',0,29,21,118,21,40},
gc.setColor(1,1,1,x/5) {'fPoly',21,0,42,29,21,40},
gc.rectangle('fill',x,0,1,1) {'setCL',.4,.4,.4},
gc.rectangle('fill',41-x,0,1,1) {'fPoly',21,118,42,29,21,40},
end }
gc.pop()
gc.setCanvas()
back.resize() back.resize()
end end
function back.resize() function back.resize()
crystal={} crystals={}
W,H=SCR.w,SCR.h
for i=1,16 do for i=1,16 do
crystal[i]={ crystals[i]={
x=i<9 and W*.05*i or W*.05*(28-i), x=i<9 and SCR.w*.05*i or SCR.w*.05*(28-i),
y=H*.1, y=SCR.h*(wingHeight[i]or wingHeight[i-8]),
a=0, a=0,
va=0, va=0,
f=i<9 and .012-i*.0005 or .012-(17-i)*.0005 f=i<9 and .012-i*.0005 or .012-(17-i)*.0005
@@ -43,31 +40,39 @@ function back.resize()
end end
function back.update() function back.update()
for i=1,16 do for i=1,16 do
local B=crystal[i] local B=crystals[i]
B.a=B.a+B.va B.a=B.a+B.va
B.va=B.va*.986-B.a*B.f B.va=B.va*.986-B.a*B.f
end end
end end
function back.draw() function back.draw()
gc.clear(.06,.06,.06) gc.clear(.06,.06,.06)
local sk,sy=SCR.k,H*.8 gc.setColor(.12,.08,.05)
gc.setLineWidth(6)
for i=1,7 do
local B1,B2=crystals[i],crystals[i+1]
gc.line(B1.x,B1.y,B2.x,B2.y)
B1,B2=crystals[i+8],crystals[i+9]
gc.line(B1.x,B1.y,B2.x,B2.y)
end
local k=SCR.k
for i=1,8 do for i=1,8 do
gc.setColor(wingColor[i]) gc.setColor(wingColor[i])
local B=crystal[i] local B=crystals[i]
gc.draw(bar,B.x,B.y,B.a,sk,sy,20,0) gc.draw(crystal_img,B.x,B.y,B.a,k,k,21,0)
B=crystal[17-i] B=crystals[17-i]
gc.draw(bar,B.x,B.y,B.a,sk,sy,20,0) gc.draw(crystal_img,B.x,B.y,B.a,-k,k,21,0)
end end
end end
function back.event(level) function back.event(level)
for i=1,8 do for i=1,8 do
local B=crystal[i] local B=crystals[i]
B.va=B.va+.001*level*(1+rnd()) B.va=B.va+.001*level*(1+rnd())
B=crystal[17-i] B=crystals[17-i]
B.va=B.va-.001*level*(1+rnd()) B.va=B.va-.001*level*(1+rnd())
end end
end end
function back.discard() function back.discard()
bar,crystal=nil crystal_img,crystals=nil
end end
return back return back