[DBarbarian Entry 4] - Polar

A collection of polar movements.

INSTRUCTIONS
Click to change the graph
Move the mouse around.
Most look the best when you move the mouse from point A to B and don’t shake it around.


Mouse.hide();
Stage.scaleMode = "noScale";

this.propA = function(n,prop,val) {
    this.methodsA = {lineStyle:["width","color","alpha"], lineTo:["x","y"], cx:["x"], cy:["y"], del:["d"], ang:["a"]};
    (prop=="lineStyle" or prop=="lineTo") ? n[prop](val[this.methodsA[prop][0]],val[this.methodsA[prop][1]],val[this.methodsA[prop][2]]) : n[prop]=(val[this.methodsA[prop][0]]);
    return n;
}

this.reset = function(numP,s,ngRot,nlRot,period,nind) {
    this.gP = {gRot:ngRot,lRot:nlRot,lP:period,ind:nind};
    for (i in this.oA) {
        this.oA*.removeMovieClip();
    }
    this.oA = new Array();
    for (i=1;i<numP;i++) {
        this.createEmptyMovieClip("o"+i,i);
        this.propA(this["o"+i],"lineStyle",{width:s,color:0xFFFFFF,alpha:100})._parent.propA(this["o"+i],"lineTo",{x:1,y:0})._parent.propA(this["o"+i],"cx",{x:this._xmouse})._parent.propA(this["o"+i],"cy",{y:this._ymouse})._parent.propA(this["o"+i],"del",{d:i})._parent.propA(this["o"+i],"ang",{a:((period/(numP-1))*i)});
        this.oA.push(this["o"+i]);
    }
}

this.calcR = function(rad,ang,ind) {
    return [((50+this.rad)*(Math.pow(Math.cos(14*ang),3))),(50+this.rad)*Math.sin(5*this.oA*.ang),(60+this.rad)*(-Math.sin(Math.cos(Math.tan(this.oA*.ang)))),(50+this.rad)*(Math.sin(5*this.oA*.ang/10)),(16+(50+this.rad)*(Math.sin(4*this.oA*.ang))),(2+this.rad)*(this.oA*.ang),40*(Math.sin(954*this.oA*.ang)-2*Math.cos(this.oA*.ang)),(200*Math.cos(2*this.oA*.ang)*Math.sin(2*this.oA*.ang)/this.oA*.ang),20*Math.abs(Math.log(Math.log(Math.tan(Math.cos(Math.pow(Math.sin(this.oA*.ang),10)))))/Math.log(10)),50*Math.sin(19*this.oA*.ang/20),40-Math.tan(2*this.oA*.ang)][this.gP.ind];
}

this.nA = new Array([31,3,100,1500,2*Math.PI,0],[31,5,100,200,Math.PI,1],[51,2,100,300,2*Math.PI,2],[41,2,100,150,1000,3],[51,2,100,150,2*Math.PI,4],[51,2,200,150,6*Math.PI,5],[51,2,250,240,2*Math.PI,6],[51,2,250,240,2*Math.PI,7],[41,2,50,240,2*Math.PI,8],[41,2,50,10,125.67,9],[41,4,90,500,2*Math.PI,10]);

this.onMouseDown = function() {
    (this.gP.ind<10)?(this.reset(this.nA[this.gP.ind+1][0],this.nA[this.gP.ind+1][1],this.nA[this.gP.ind+1][2],this.nA[this.gP.ind+1][3],this.nA[this.gP.ind+1][4],this.nA[this.gP.ind+1][5])):(this.reset(31,3,100,1500,2*Math.PI,0));
    
    this.onEnterFrame = function() {
        (this.cr + (2*Math.PI)/this.gP.gRot <= 2*Math.PI) ? (this.cr += (2*Math.PI)/this.gP.gRot):(this.cr+=(2*Math.PI)/this.gP.gRot-2*Math.PI);
        for (i in this.oA) {
            (this.oA*.ang + this.gP.lP/this.gP.lRot <= this.gP.lP) ? (this.oA*.ang += this.gP.lP/this.gP.lRot):(this.oA*.ang+=this.gP.lP/this.gP.lRot-this.gP.lP);
            (this.rad += (Math.sqrt((this._xmouse-this.px)*(this._xmouse-this.px)+(this._ymouse-this.py)*(this._ymouse-this.py))/20-this.rad)/30);
            for (j=0;j<2;j++) {
                (j==0) ? (this.oA*.cx += (this._xmouse-this.oA*.cx)/this.oA*.del):this.oA*.cy += (this._ymouse-this.oA*.cy)/this.oA*.del;
                (j==0) ? (this.oA*._x = this.oA*.cx + (this.calcR(this.rad,this.oA*.ang,this.gP.ind))*Math.cos(this.oA*.ang+this.cr)):(this.oA*._y = this.oA*.cy +(this.calcR(this.rad,this.oA*.ang,this.gP.ind))*Math.sin(this.oA*.ang+this.cr));
            }
        }
        this.px = this._xmouse;
        this.py = this._ymouse;
    }
}

EDIT: Forgot to thank Sinister Shadow for the property assignment idea. :slight_smile: