JavaScript立体動画(交差法)

立体写真はオクユキさん撮影

ソース
<html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS"> <title>JavaScript立体動画</title> <script language="javascript"> ///イメージセット/// function imgset(){ mv_l=new Array(); mv_r=new Array(); for(i=1;i<=img_n;i++ ){ mv_l[i]=new Image();mv_l[i].src=fil_l[i]; mv_r[i]=new Image();mv_r[i].src=fil_r[i]; } document.write('<center><table border=5><tr><td>'); ///左窓(右目用)/// document.write('<img src="',fil_r[1],'" name="xy_l" width=',img_w,' height=',img_h,' border=0 usemap="#homemap_l">'); ///マップセット/// document.write('<MAP NAME="homemap_l">'); i=1;y=0;y1=img_h; for (x=0;x<=img_w;x=x+20){ x1=x+20; document.write('<AREA SHAPE="rect" COORDS="'+x+','+y+','+x1+','+y1+ '" HREF="JavaScript:;" onMouseOver="hand()">'); } document.write('</MAP>'); document.write('</td><td width=60></td><td>'); ///右窓(左目用)/// document.write('<img src="',fil_l[1],'" name="xy_r" width=',img_w,' height=',img_h,' border=0 usemap="#homemap_r">'); ///マップセット/// document.write('<MAP NAME="homemap_r">'); i=1;y=0;y1=img_h; for (x=0;x<=img_w;x=x+20){ x1=x+20; document.write('<AREA SHAPE="rect" COORDS="'+x+','+y+','+x1+','+y1+ '" HREF="JavaScript:;" onMouseOver="hand()">'); } document.write('</MAP>'); document.write('</td></tr></table>'); document.write('<font size=2>手動時、写真をマウスで「なでる」と動画になります。</font>'); document.write('<form>'); document.write('<input type="button" value="+" onClick="spd(-20)">'); document.write('<input type="button" value="自動" onClick="move()">'); document.write('<input type="button" value="-" onClick="spd(20)">'); document.write('.<input type="button" value="手動" onClick="stop()">'); document.write('</form>'); document.write('</center>'); } ///自動/// p=0; tm=""; function move(){ flg=1; p++;if(p>img_n){p=1;} document.xy_l.src=mv_r[p].src; document.xy_r.src=mv_l[p].src; clearTimeout(tm); tm=setTimeout("move()",tim); } ///速度/// function spd(s){ if (flg==1){ tim=tim+s; if(tim<1){tim=1;} clearTimeout(tm); move(); } } ///自動切/// function stop(){ clearTimeout(tm); flg=0; } ///手動/// function hand(){ if (flg==0){ p++;if(p>img_n){p=1;} document.xy_l.src=mv_r[p].src; document.xy_r.src=mv_l[p].src; } } flg=0; fil_l=new Array(); fil_r=new Array(); url="../3d/" n=0; ////////////////左の写真/////////////////右の写真//// n++;fil_l[n]=url+"3dl_t1.jpg";fil_r[n]=url+"3dr_t1.jpg"; n++;fil_l[n]=url+"3dl_t2.jpg";fil_r[n]=url+"3dr_t2.jpg"; n++;fil_l[n]=url+"3dl_t3.jpg";fil_r[n]=url+"3dr_t3.jpg"; //////////////////////////////////////////////////// img_w=200;img_h=400; //イメージの縦横巾 img_n=n; //イメージの枚数 tim=100; //スピード </script> </head> <BODY> <CENTER> <h2>JavaScript立体動画</h2> <table border=0><tr><td> <SCRIPT Language="JavaScript"> imgset(); move(); </script> </td></tr><tr><th> </td></tr></table> </CENTER> </BODY> </HTML>
ソースをお使いの場合は出来るだけ私のホームページにリンクを貼ってください。
URL:http://www2a.biglobe.ne.jp/~qpon/    バーナ:還暦QPON