Log In  


Could someone make cart that shows some basic transition effects (crossfade, swipe left/up/down, fade to black, etc) for those who want to have those but don't have skills to code it?

3


2

crossfade is going to be pretty tricky, because you'll have to store the whole screen in lua variables and have blends between all 16 colors (16x16xblend_levels array, plus 1920 variables minimum for screen data). I did fade to black and white like this:

_shex={["0"]=0,["1"]=1,
["2"]=2,["3"]=3,["4"]=4,["5"]=5,
["6"]=6,["7"]=7,["8"]=8,["9"]=9,
["a"]=10,["b"]=11,["c"]=12,
["d"]=13,["e"]=14,["f"]=15}
_pl={[0]="00000015d67",
     [1]="0000015d677",
     [2]="0000024ef77",
     [3]="000013b7777",
     [4]="0000249a777",
     [5]="000015d6777",
     [6]="0015d677777",
     [7]="015d6777777",
     [8]="000028ef777",
     [9]="000249a7777",
    [10]="00249a77777",
    [11]="00013b77777",
    [12]="00013c77777",
    [13]="00015d67777",
    [14]="00024ef7777",
    [15]="0024ef77777"}
_pi=0-- -100=>100, remaps spal
_pe=0-- end pi val of pal fade
_pf=0-- frames of fade left
function fade(from,to,f)
    _pi=from _pe=to _pf=f
end

and in _update at the bottom:

if(_pf>0) then --pal fade
    if(_pf==1) then _pi=_pe
    else _pi+=((_pe-_pi)/_pf) end
    _pf-=1
end

and in _draw at the bottom:

local pix=6+flr(_pi/20+0.5)
if(pix!=6) then
    for x=0,15 do
        pal(x,_shex[sub(_pl[x],pix,pix)],1)
    end
else pal() end

Then you just call fade(0,-100,8); (to fade from default colors to solid black in 8 frames), and transition when _pf==1

Swipe (which I think means the wipe effect where it moves to an edge?) would probably use memcpy on the screen memory with a big for loop. I think you can do it, but there might be lag on that.


About fades, I've rather thought about "dithered" version:



[Please log in to post a comment]