diff --git a/panel_extreme.p8 b/panel_extreme.p8 index 20c5fa2..38d9b13 100644 --- a/panel_extreme.p8 +++ b/panel_extreme.p8 @@ -131,6 +131,13 @@ end function init_title() pal({[0]=0x82,0x82,0x84,0x84,4,4,0x89,0x89,0x8e,0x8e,0x8f,0x8f,15,15,0x87,0x87},2) + local antbar = ants.new{ + progress=-0.5, + bgcolor=8, + fgcolor=10, + trcolor=9, + speed=1/15, + w=128,h=2} return view.of{ bg.new{c=15}, @@ -141,6 +148,18 @@ function init_title() self.x=32+6*cos(time()/3.7) end, }, + {update = function() + local p = antbar.progress + 0.003 + if p > 1.5 then + p = -0.5 + antbar.speed += 1/30 + end + antbar.progress = p + end}, + view.new{ + views=antbar, + y=50,h=2, + }, } end @@ -350,24 +369,73 @@ function printz(str) print(str, 0, 0) end} end + +-- horizontal marching ants +ants = { + w=60, h=1, + stride=10, + + -- bgcolor=0, --nil: transparent + ldcolor=7, + fgcolor=6, + trcolor=5, + + speed=2/60, + offset=0, + + progress=0.0, +} +mknew(ants) + +function ants:update() + local stride = self.stride + local off = self.offset + self.speed * stride + if (off > stride) off -= stride + self.offset = off +end + +function ants:draw() + local w,h,s,p,bg=self.w, self.h, self.stride,self.progress,self.bgcolor + if (bg) rectfill(0,0,w,h,bg) + if (p<=0) return + local x0 = (self.offset-s)&-1 + local bw = (p*s)&-1 + if bw > 1 then + local bwm2,c = bw-2,self.fgcolor + for x=x0,w,s do + rectfill(x,0,x+bwm2,h,c) + end + end + if bw > 0 then + local c = self.ldcolor + for x=x0+bw-1,w,s do + rectfill(x,0,x,h,c) + end + end + if p < 1 then + local c = self.trcolor + for x = x0-1+s,w,s do + rectfill(x,0,x,h,c) + end + end +end __gfx__ -0000000000000000000000000000000009999900066666000eeeee00077777000aaaaa0001111111000000000000000000000000000000000000000000000000 -00000000000000000000000000000000988888206bbbbb30eddddd207cccccd0a999994012222222300040400000000000000000000000000000000000000000 -00700700000000000000000000000000987878206b77bb30edd7dd207c7cccd0a979794012222222300444440000000000000000000000000000000000000000 -00077000000000000000000000000000987778206b777b30ed777d207c77ccd0a997994012222222300444440000000000000000000000000000000000000000 -00077000000000000000000000000000988788206bb77b30edd7dd207c777cd0a979794012222222300044400000000000000000000000000000000000000000 -00700700000000000000000000000000988888206bbbbb30eddddd207cccccd0a999994012222222300004000000000000000000000000000000000000000000 -000000000000000110101011000000000222220003333300022222000ddddd000444440012222222300444440000000000000000000000000000000000000000 -000000000000001d5151515d10000000000000000000000000000000000000000000000012222222300444400000000000000000000000000000000000000000 -00000000000000151010101510000000011111004040440004000400000000000000000003333333000444000000000000000000000000000000000000000000 -00000000000000010000000100000000122222304440444044404440000000000000000000000000000440000000000000000000000000000000000000000000 -00000000000000151000000510000000122222300400044040400400007070000000000000000000000400000000000000000000000000000000000000000000 -00000000000000010000000100000000122222300000000000000000007070000000000000040004440004000000000000000000000000000000000000000000 -00000000000000151000000510000000122222304040400004004440000000000000000000444044444044400000000000000000000000000000000000000000 -00000000000000010000000100000000122222300400440040404040007770000000000004444444444044400000000000000000000000000000000000000000 -00000000000000151000000510000000033333004040444004004440000000000000000000444044444444440000000000000000000000000000000000000000 -000000000000001d5151515d10000000000000000000000000000000000000000000000000040004440444440000000000000000000000000000000000000000 -00000000000000011010101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000111000011011000000000009999900066666000eeeee00077777000aaaaa0001111111000000000000000000000000000000000000000000000000 +00000000012221001221221000000000988888206bbbbb30eddddd207cccccd0a999994012222222300040400000000000000000000000000000000000000000 +00700700121110000112110000000000987878206b77bb30edd7dd207c7cccd0a979794012222222300444440000000000000000000000000000000000000000 +00077000121000000012100000000000987778206b777b30ed777d207c77ccd0a997994012222222300444440000000000000000000000000000000000000000 +00077000121000000001000000000000988788206bb77b30edd7dd207c777cd0a979794012222222300044400000000000000000000000000000000000000000 +00700700010000000001000000000000988888206bbbbb30eddddd207cccccd0a999994012222222300004000000000000000000000000000000000000000000 +000000000000000000121000000000000222220003333300022222000ddddd000444440012222222300444440000000000000000000000000000000000000000 +00000000000000000001000000000000000000000000000000000000000000000000000012222222300444400000000000000000000000000000000000000000 +00000000000000000000000000000000011111004040440004000400000000000000000003333333000444000000000000000000000000000000000000000000 +00000000000000000000000000000000122222304440444044404440000000000000000000000000000440000000000000000000000000000000000000000000 +00000000000000000000000000000000122222300400044040400400007070000000000000000000000400000000000000000000000000000000000000000000 +00000000000000000000000000000000122222300000000000000000007070000000000000040004440004000000000000000000000000000000000000000000 +00000000000000000000000000000000122222304040400004004440000000000000000000444044444044400000000000000000000000000000000000000000 +00000000000000000000000000000000122222300400440040404040007770000000000004444444444044400000000000000000000000000000000000000000 +00000000000000000000000000000000033333004040444004004440000000000000000000444044444444440000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000040004440444440000000000000000000000000000000000000000 __map__ 0102020202020203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1112121212121213000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000