// David Mahfouda 2004 // Oliver Knill, 2004 // 2D curl animation action script //vector functions function P(x,y) { return exp(y,3); } function Q(x,y) { return 3*exp(x,2)*y; } function rot(x,y) { return 3*y*y-6*x; } // preparations x_center = 200; // body center y_center = 200; // body center nvec = 5; // number of vectors per half plane rr = 50; // size of wheel spacing = 37; // spacing between vectors in field mathpi180 = Math.PI/180; // a constant which often occurs onethird = 2*Math.PI/3; // dito a=0.3; // length of head b=0.1; // width of head c=10; // shadow displacement maxcurl=0; // the maximal curl on the region mincurl=0; // the minimal curl on the region sss1=0; sss2=0; // the actual timeline cursorinit(); soundinit(); textt(); axes(); vfield(); findmax(); onEnterFrame = function() { mousmove(); cursorspin(fieldcurl); } // initiate sound function soundinit() { wind=new Sound(); wind.attachSound("wind"); wind.setVolume(0); wind.start(0, 999999); wind1=new Sound(); wind1.attachSound("reverse"); wind1.setVolume(0); wind1.start(0, 999999); } // initiates cursor function cursorinit() { _root.createEmptyMovieClip("cursor",1); } //reads curl of vector field at mouse location function mousmove() { xx = _xmouse - x_center; yy = _ymouse - y_center; fieldcurl = rot(xx,yy); curl.text = "Curl: " + fieldcurl; if (fieldcurl<0) { wind.setVolume(Math.floor(Math.abs(fieldcurl*sss1))); wind1.setVolume(Math.floor(0)); } else { wind.setVolume(Math.floor(0)); wind1.setVolume(Math.floor(Math.abs(fieldcurl*sss2))); } } //draw coordinate axes function axes() { //y-axis _root.lineStyle(2,000000,30); _root.moveTo(x_center,20); _root.lineTo(x_center,380); vec0(x_center,18,x_center,0,2,0,0,0,30); //x-axis _root.moveTo(20, y_center); _root.lineTo(380, y_center); vec0(382,y_center,400,y_center,2,0,0,0,30); } // create text boxes to read curl function textt () { _root.createTextField("curl", 0, 300, 370, 200, 30); } //graph vector field function vfield() { for (i=-nvec; imaxcurl) {maxcurl=cc;} if (cc