//Psycho test perception frequency 1 var i,j,pause,dpause,position,dy,period,xmin,xmax; var h1,h2,m1,m2,s1,s2,ms1,ms2,time,key; function inittime() { var now = new Date(); h1 = now.getHours(); m1 = now.getMinutes(); s1 = now.getSeconds(); ms1 = now.getMilliseconds(); } function gettime() { var temp; var now = new Date(); h2 = now.getHours(); m2 = now.getMinutes(); s2 = now.getSeconds(); ms2 = now.getMilliseconds(); if (j==0) { time=(3600*(h2-h1)+60*(m2-m1)+s2-s1)*1000+ms2-ms1; h1=h2;m1=m2;s1=s2;ms1=ms2; } else { temp=(3600*(h2-h1)+60*(m2-m1)+s2-s1)*1000+ms2-ms1; temp=h2;temp=m2;temp=s2;temp=ms2; } } function init() { initgraph(); key='a'; dpause=1; pause=40*dpause; position=0; dy=40; period=4; xmin=40; xmax=360; j=0; settextjustify('left','top'); outtextxy(400,20,'f faster | s slower | i info | e end'); inittime(); } function faster() { if (pause>=dpause) pause-=dpause; } function slower() { pause+=dpause; } function nextposition() { position++; if (position==period) position=0; } function prevposition() { if (position==0) position=period-1; else position--; } function drop() { for (i=0; i<=2; i++) { setfillstyle(1,0); bar(xmin,i*period*dy+position*dy,xmax,i*period*dy+(position+1)*dy); nextposition(); setfillstyle(1,15); bar(xmin,i*period*dy+position*dy,xmax,i*period*dy+(position+1)*dy); prevposition(); } nextposition(); } function info() { setfillstyle(1,0); bar(400,0,640,80); setcolor(15); outtextxy(400,20,'f faster | s slower | i info | e end'); outtextxy(400,40,'time for 10 periods [ms]: '+time); outtextxy(400,60,'pause='+pause); time=0; } function animate() { j++; if (j==10*period) j=0; gettime(); if (keypressed()) { key=readkey(); if ((key=='f')||(key=='F')) faster(); if ((key=='s')||(key=='S')) slower(); if ((key=='i')||(key=='I')) info(); } drop(); if ((key!='e')&&(key!='E')) setTimeout('animate()',pause); else { closegraph(); exit(); } } function run() { init(); animate(); }