2 Replies Latest reply on Jul 22, 2006 5:09 AM by Chris McLaughlin

    Circle Drawing

    Chris McLaughlin Level 1
      Hi,

      I found the following script to draw a circle but I wan to start drawing the circle at 12:00 rather than 3:00. An anyone help?

      function Circle( x, y, r ) {
      this.r = 35;
      this.x = 694;
      this.y = 153;
      this.point_arr = [];
      this.id = undefined;
      this.updater = 0;
      this.update_speed = 100;
      this.prog_inc = 1;
      this.depth = Circle.count;
      Circle.count++; }

      Circle.count = 0;

      Circle.prototype.SetUpdateSpeed = function( num ) {
      this.update_speed = num; }

      Circle.prototype.SetProgressIncrement = function( num ) {
      this.prog_inc = num; }

      Circle.prototype.UpdateCircle = function() {
      this.id = setInterval( _Update, this.update_speed, this );
      function _Update( me ) {
      var newname = "circle_" + String( me.depth ) + "_mc";
      var circle = _root.createEmptyMovieClip( newname, me.depth );
      circle._x = me.x;
      circle._y = me.y;
      _Redraw();
      var angle = (( me.updater * ( Math.PI * 2 ) ) / 100);
      var x = Math.cos( angle ) * me.r;
      var y = Math.sin( angle ) * me.r;
      //trace(angle);
      //trace(x);
      //trace(y);
      circle.lineStyle( 0, 0, 0 );
      circle.lineTo( x, y );
      me.point_arr.push( [x,y] );
      me.updater += me.prog_inc;
      if ( me.updater >= 100 ) {
      circle.beginFill(0xFF0000);
      circle.lineStyle( 0, 0x000000, 0 );
      circle.lineTo( me.r, 0 );
      circle.lineStyle( 0, 0x000000, 0 );
      circle.endFill();
      clearInterval( me.id ); }
      else {
      //circle.beginFill(0xFF0000);
      circle.lineStyle( 0, 0x000000, 0 );
      circle.endFill(); }

      function _Redraw() {
      circle.lineStyle( 0, 0x000000, 0 );
      //circle.beginFill( 0, 10 );//0xcccccc,
      circle.beginFill( 0xFF0000 );//0xcccccc,
      circle.moveTo( 0, 0 );
      circle.lineTo( me.r, 0 );
      circle.lineStyle( 0, 0x000000, 0 );
      for ( var i = 0; i < me.point_arr.length; i++ ) {
      circle.lineTo( me.point_arr [0], me.point_arr[1] ); } } } }



      mc = new Circle( Stage.width/2, Stage.height/2, 100 ); // set position / size
      mc.SetUpdateSpeed( 1 );
      mc.SetProgressIncrement( .8 ); // set speed here
      mc.UpdateCircle();
      /*
      mc2 = new Circle( 300, 250, 50 );
      mc2.UpdateCircle();
      */