msie=(navigator.appVersion).indexOf("Trident");
var tim=33;
if(msie>0){
if(speed<0.8){
spp=0.8/speed;
tim=33*spp;
speed=0.8;
}
}
if(waves>0){scale*=-1;}
if (lake === undefined) {
var lake=100;
}
ll=lake/100;
document.write("
");
document.write("
");
document.write("
");
document.write("
");
document.write("
波の動き準備中");
document.write("
システムの提供:QPON");
document.write("
")
//
var img = new Image();
function imgLoadedCheck(){
img.src = ur+file;//setting.img;
img.onload = function(){
/*
setTimeout("wave()",200);
return;
};
}
function wave() {
*/
var cv = document.createElement('canvas');
cv.style.zIndex = 0;
cv.width = img.width;
cv.height = img.height*(1+ll);
//document.getElementById("wave").style.height=img.height*(1+ll);
var ctx = cv.getContext('2d');
document.getElementById('wave').appendChild(cv);
var w, h,dw,dh;
var offset = 0;
var frame = 0;
var max_frames = 0;
var frames = [];
ctx.save();
ctx.drawImage(img, 0, 0);
ctx.scale(1, -1);
ctx.drawImage(img, 0, -img.height*2);
ctx.restore();
w = ctx.canvas.width;
h = ctx.canvas.height;
dw=w;
dh=h/(1+ll);
var id = ctx.getImageData(0, h/(1+ll), w, h*ll).data;
var end = false;
ctx.save();
while (!end) {
var odd = ctx.getImageData(0, h/(1+ll), w, h*ll);
var od = odd.data;
var pixel = 0;
for (var y = 0; y < dh; y++) {
for (var x = 0; x < dw; x++) {
var displacement = (scale * 10 * (Math.sin((h/(y/waves)) + (-offset)))) | 0;
var j = ((displacement + y) * w + x + displacement)*4;
if (j < 0) {
pixel += 4;
//if(pixel>12){pixel=0;}
continue;
}
var m = j % (w*4);
var n = scale * 10 * (y/waves);
if (m < n || m > (w*4)-n) {
var sign = y < w/2 ? 1 : -1;
od[pixel] = od[pixel + 4 * sign];
od[++pixel] = od[pixel + 4 * sign];
od[++pixel] = od[pixel + 4 * sign];
od[++pixel] = od[pixel + 4 * sign];
++pixel;
continue;
}
if (id[j+3] != 0) {
od[pixel] = id[j];
od[++pixel] = id[++j];
od[++pixel] = id[++j];
od[++pixel] = id[++j];
++pixel;
} else {
od[pixel] = od[pixel - w*4];
od[++pixel] = od[pixel - w*4];
od[++pixel] = od[pixel - w*4];
od[++pixel] = od[pixel - w*4];
++pixel;
}
}
}
if (offset > speed * (6/speed)) {
offset = 0;
max_frames = frame - 1;
frame = 0;
document.getElementById('comBox').style.display='none';
document.getElementById('demo').style.display='none';
end = true;
} else {
offset += speed;
frame++;
frames.push(odd);
}
ctx.restore();
};
setInterval(function() {
ctx.putImageData(frames[frame], 0, h/(1+ll));
if (frame < max_frames) {
frame++;
} else {
frame = 0;
}
}, tim);
}
}
//imgLoadedCheck();
window.addEventListener('load', imgLoadedCheck, false);