Donut : z‑sorting

Still mess­ing around JS game things.. herun­ter­laden.
This time I tried to imple­ment sim­ple Z‑sorting.

Try it here: http://media.dkpn.jp/js/multi-chara-01/
It should work OK on recent ver­sions of Fire­fox, Chrome and Safari pro­gramm zum down­load­en von videos.

15 char­ac­ters are ran­dom­ly gen­er­at­ed on each refresh. I tried to push a bit the num­bers : it’s fine until 50 char­ac­ters, but starts to be real slow after texte zum down­load­en. 200 or more char­ac­ters is just incred­i­bly slow, and may even crash the brows­er…

I guess it’s because of my way of updat­ing depth :

1
2
3
4
5
6
7
8
func­tion check­Z­sort (how­Many) {
    for (i=0; i<how­Many; i++) {
        var id = i+1;
        var pos_t = Math.round($(‘#chara-’+id).posi­tion().top);
        $(‘#chara-’+id).css(‘z‑index’,pos_t);
    };
    set­Time­out(func­tion(){ check­Z­sort  (how­Many); }, 500 );
  }

Maybe there is a less CPU inten­sive way to deal with this qr code for free? I did­n’t man­age to include it direct­ly into the char­ac­ters ani­ma­tion func­tion…
My code is pret­ty messy, but if you’re curi­ous it’s here Down­load debian dvd.

4 Comments