Hi!
Let's start a library of transition effects!
They should take one argument called progress
. If you want to fade out instead of in you just use fade(1-progress)
.
My first contribution:
function fade(progress) for xx=0,15 do for yy=0,15 do circfill(xx*8+4,yy*8+4,8*(1-progress)+sin((yy)/15),0) end end end |


1


Here is one that I made.
function fade(progress) p=progress*152 for i=8,2,-2 do grid(i) p-=38 end end function grid(mx) for y=0,15 do for x=0,15 do l=min(2*flr((p-(x+y))/2),mx)/2 if l>0 then rect(x*8+4-l,y*8+4-l,x*8+3+l,y*8+3+l,0) end end end end |



function fade(p) if not _░_ then --shuffle rnd-id _░_={} for i=0,255 do add(_░_,i) add(_░_,deli(_░_),rnd(i)+1) end end local i,s=1/(256+1) --make an extra loop poke(0x5f55,0x0) rectfill(8,0,23,15,0) --init sprite{1,2,17,18} poke(0x5f55,0x60) while p>0 do s=_░_[p\i+1] or 0 sset(s\16%16+8,s%16,7) p-=i end pal(7,0) local s={1,2,17,18} --sprite-id table local p,q for i=0,255 do local p,q,r=unpack(_░_,i+1,i+4) spr(s[p%4+1],i%16*8,i\16%16*8,1,1,(q or 1)%2==0,(r or 2)%2==0) end pal() end |

Applied to.

I learned about your project from this post!
I edited based on @RealShadowCaster's fade function.



Might as well try out making one..
A dithering style fade (this one uses the sprite at #127 to be repeated accross the screen)
edit: did it the wrong way round (oops), this one fades in

function fade(progress) for i=0, 3 do for j=0, 3 do for k=0, 4 do sset((i%2)+(j%2)*2+(k%2)*4+120,((i+1)\2)+(j\2)*2+(k\2)*4+56,5-#tostr(i*4+j > progress*16)) end end sset(i*2+121,56,5-#tostr(progress < 0.6)) end pal(1,0) for i=0, 15 do for j=0, 15 do spr(127,i*8,j*8) end end pal() end |

1


That one uses @lightsBlue trick to write in sprite 127 as above, but the sprite darkening is done in spiral instead of with dithering patterns.

function fade(progress) local px,py,dx,dy=123,59,0,-1 for i=56,63 do for j=120,127 do sset(j,i,0) assert(sget(j,i)==0) end end while progress>0 do sset(px,py,1) if(sget(px-dy,py+dx)==0) then px,py,dx,dy=px-dy,py+dx,-dy,dx else px,py=px+dx,py+dy end progress-=1/64 end pal(1,0) spr(0,0,0,16,16) for i=0, 15 do for j=0, 15 do spr(127,i*8,j*8) end end pal() end |
[Please log in to post a comment]