/** * inisialisasi image buffer */ var fotoList = new Array(TOTAL_FOTO); var fotoTag = new Array(TOTAL_IMAGE_PER_FOTO); function init_buffer_image(){ for(var i = 0; i < TOTAL_FOTO; i++){ fotoList[i] = new Array(TOTAL_IMAGE_PER_FOTO); for(var j=0; j< TOTAL_IMAGE_PER_FOTO; j++){ fotoList[i][j] = new Image(); fotoList[i][j].src = "componentImage.php?com=photoFlash&d="+FOTO_LIST_DIR[i]+"&f=" + FOTO_LIST_FILE_PREFIX[i] + ((j < 9)?"0":"") + (j + 1) + ".jpg"; } } for(j=0; j< TOTAL_IMAGE_PER_FOTO; j++){ fotoTag[j] = document.getElementById("foto_"+(j + 1)); fotoTag[j].src = fotoList[0][j].src; } clearInterval(timer); animating_foto(); } /** * animation */ var timer; var loadedFoto = false; var idx_foto = 0; var idx_random = 0; var idx_array_random = Math.floor(Math.random() * TOTAL_FOTO); var idx_foto_random = Math.floor(Math.random() * TOTAL_FOTO_RANDOM); function animating_foto(){ try{ if(fotoList[FOTO_RANDOM[idx_foto_random][idx_foto]][IMAGE_RANDOM[idx_array_random][idx_random]].complete){ fotoTag[IMAGE_RANDOM[idx_array_random][idx_random]].src = fotoList[FOTO_RANDOM[idx_foto_random][idx_foto]][IMAGE_RANDOM[idx_array_random][idx_random]].src; idx_random += 1; if(idx_random < 24){ clearInterval(timer); timer = setInterval("animating_foto()", 200); }else{ loadedFoto = true; } }else{ clearInterval(timer); timer = setInterval("animating_foto()", 10); } }catch(e){ // alert(idx_foto_random+" : "+idx_foto); } if(loadedFoto){ idx_foto = (idx_foto < TOTAL_FOTO - 1)?(idx_foto+1):0; if(idx_foto == 0){ idx_foto_random = (idx_foto_random + Math.ceil(Math.random() * (TOTAL_FOTO_RANDOM - 1))) % TOTAL_FOTO_RANDOM; } loadedFoto = false; idx_random = 0; idx_array_random = (idx_array_random + Math.ceil(Math.random() * (TOTAL_FOTO - 1))) % TOTAL_FOTO; clearInterval(timer); timer = setInterval("animating_foto()", 5000); } }