ÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÀ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌÀ¬ÀÀÀ¬ÀÀÀ¬ÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀ¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >±?  ""     "   " " " """ """""" "   "" "             """""" """"""""       3  0033 0 3 0033033 330 " "0" 03" 30"30 0 03 0 0 03"00 0033 30  00 0 3 03 33 " "033  "0003 ""00 "003 " 00                " ""  " """""         "  " """"" "  " " "  " """  """" " "          -- title: wobble effect -- author: borb -- desc: sine waves stacked on top of each other, inspired by https://managore.itch.io/holey-hell -- site: www.emuurom.com -- license: MIT License (change this to your license of choice) -- version: 0.1 -- script: lua t=0 x=96 y=24 sin,cos,pi=math.sin,math.cos,math.pi del=table.remove to=table.insert function rm(tbl,E) for i,v in pairs(tbl)do if v==E then del(tbl,i)return end end end function ripairs(t)--reverse ipairs. https://gist.github.com/balaam/3122129 return function(t,i) i=i-1 if i~=0 then return i,t[i] end end, t,#t+1 end function lerpClamp(a,b,t)return t<0 and a or t>1 and b or a+(b-a)*t end function drwblob(r0,color,t) local x0,y0=120,60 local sins={ {A=4,v=8}, {A=4,v=4}, {A=3,v=2}, {A=2,v=1}, {A=4,v=15}, } local r,x,y=0,0,0 local dphi=.05 for phi=0,2*pi+dphi,dphi do r=0 for j,s in ipairs(sins)do r=r+s.A*sin(t/50)*r0*.02*sin(phi*s.v+t/100) end local oldx,oldy=x,y x,y= (r+r0)*cos(phi), (r+r0)*sin(phi) if phi>=dphi then if fill then tri(x0,y0,x0+x,y0+y,x0+oldx,y0+oldy,color) else line(x0+x,y0+y,x0+oldx,y0+oldy,color) end end end end blobs={} local i=0 bg=0 function newblob(color) to(blobs,{ color=color, a=0, t=0, upd=function(blob) local a=0 for i=0,3 do a=a+lerpClamp(0,50,(blob.t-120*i)/60) end blob.a=a blob.t=blob.t+1 if blob.a>175 then bg=blob.color del(blobs,1) end end, }) end fill=true function TIC() if btnp(4)then fill=not fill end if t%120==0 then newblob(i%4+1) i=i+1 end for i,blob in ipairs(blobs)do blob:upd() end cls(fill and bg or 0) for i,blob in ipairs(blobs)do drwblob(blob.a,blob.color,blob.t*5) end t=t+1 end --unused: function resetfilled() filled={} for y=-50,136 do filled[y]={}end end function floodfillqueue(x0,y0,color) local midcolor=pix(x0,y0) local pixelstocolor={{x=x0,y=y0,dir={x=x0,y=y0}}} local i=0 local newpix=function(prev,x,y) local new={x=x,y=y,dir=prev} if new.x~=prev.dir.x or new.y~=prev.dir.y then to(pixelstocolor,new)end end while #pixelstocolor>0 and i<27000 do i=i+1 local curr=pixelstocolor[1] local x,y=curr.x,curr.y del(pixelstocolor,1) if not filled[y][x]and pix(x,y)==midcolor and (x>0 and x<240 and y>0 and y<136)then pix(x,y,color) filled[y][x]=color newpix(curr,x+1,y) newpix(curr,x-1,y) newpix(curr,x,y+1) newpix(curr,x,y-1) trace(x.." "..y) end end end function floodfill(x,y,color) local midcolor=pix(x,y) trace(midcolor) local i=0 flfil=function(x,y,color) if not filled[y][x] and pix(x,y)==midcolor and (x>=0 and x<=240 and y>=0 and y<=136)then pix(x,y,color) filled[y][x]=color flfil(x+1,y,color) flfil(x-1,y,color) flfil(x,y+1,color) flfil(x,y-1,color) end i=i+1 end flfil(x,y,color) end