sensationbox
>> liveCode
function CalcMandOri(x,y) { zi=y; zr=x; ci=y; cr=x; i=0; while (((zr+zi)<4) && (i<100)) { zro=zr; zr=zr*zr-zi*zi+cr; zi=2*zro*zi+ci; i++; } return i*2.5; } var rr,rg,rb; function CalcMand(x,y) { zi=y; zr=x; ci=y; cr=x; i=0; while (((zr+zi)<4) && (i<255)) { zro=zr; zr=zr*zr-zi*zi+(1+i*i/1000)*cr; zi=2*zro*zi+(1+i*i/1000)*ci; //zr+=i/10; i++; } rr=i; rg=rr*2; rb=rg*2; if (rg>255) rg=255; if (rb>255) rb=255; } var x,y,PleaseStop; function DoIt() { PlotWidth=500; PlotHeight=500; //window.status=x+","+y; while (y<500) { CalcMand((x-PlotWidth/2)/125,(y-PlotHeight/2)/125); jsPlot.MgPutPixel(x,y,rr,rg,rb); y++; } y=0; x++; // refreshing the screen takes some time, so do it every 4 columns only if (x%4==0) jsPlot.Refresh(); if ((x<500) && (!PleaseStop)) { setTimeout("DoIt();",1); } else { jsPlot.Refresh(); } } function Start() { x=0; y=0; PleaseStop=false; // there's no sleep(), wait() or anything in javascript to do a messageloop // looks like setTimeout is the only way to keep the browser reacting, while // heavy computations are goin on... setTimeout("DoIt()",1); } function Stop() { PleaseStop=true; }
load code:
colorfulfun
colorfulfun.txt
colorfun2
colorfun2.txt
marekbrot
marekbrot.txt
wirbelkrake
wirbelkrake.txt
wirlgirl
wirlgirl.txt