breath signal layer

might want to make it more subtle later but I'm zonking myself with it
for now. can just add a fuzz stage to it if I want. these colors are not
final, but I think I do not want to do anything clever with bitplane
interference at this time -- this effect is good as-is.
This commit is contained in:
Kistaro Windrider 2024-02-09 19:50:54 -08:00
parent ef59dc3f6a
commit ff60db72ad
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -482,6 +482,76 @@ function fuzzy_stripey:draw()
end
end
--@musurca & @felice
function cminskycirc(r,c)
local j,k,rat=r,0,1/r
poke(0x5f25,c) --set color
for i=1,r*0.785 do
k-=rat*j
j+=rat*k
pset(63.5+j,63.5+k)
pset(63.5+j,63.5-k)
pset(63.5-j,63.5+k)
pset(63.5-j,63.5-k)
pset(63.5+k,63.5+j)
pset(63.5+k,63.5-j)
pset(63.5-k,63.5+j)
pset(63.5-k,63.5-j)
end
pset(63.5,63.5-r)
pset(63.5,63.5+r)
pset(63.5-r,63.5)
pset(63.5+r,63.5)
end
breather = {
colors = {1,2,4,2,1},
sep = 5,
speed=240,
f=0,
}
mknew(breather)
function breather:update()
local f = self.f + 1
if (not self.on) f = 0
if (f >= self.speed) f = -self.speed
if f == 0 and self.nextspeed then
self.speed = self.nextspeed
self.nextspeed = nil
end
self.f = f
end
function easeinout(t)
if(t<.5) then
return t*t*t*4
else
t-=1
return 1-t*t*t*-4
end
end
function breather:draw()
fillp(0)
local cols, f, spd, sep = self.colors, self.f, self.speed, self.sep
local stall = sep * (#cols - 1)
local cap = spd-stall
if (f >= 0) f += stall
for i,c in ipairs(cols) do
local ef = f - (i-1)*sep
ef = abs(ef) - stall
if ef <= cap and ef > 0 then
cminskycirc(easeinout(ef/cap)<<6,c)
end
end
end
function breather:starting_reverse()
return self.f + self.speed < self.sep * #self.colors
end
-->8
-- awakener
@ -1027,7 +1097,11 @@ function start_game()
f = function()
pal()
clear_alt_pal_bits()
return view.of{bg.new(), fuzzy_stripey.new{interval=7, tries=5}}
return view.of{
bg.new(),
fuzzy_stripey.new{interval=7, tries=5},
breather.new{on=true},
}
end,
},
}