flash actionscript:
Off the top of my head...can you set the rotation to 90 after you instantiate it? Like... mc = new Circle( Stage.width/2, Stage.height/2, 100 ); // set position / size mc._rotation = 90; mc.SetUpdateSpeed( 1 ); mc.SetProgressIncrement( .8 ); // set speed here mc.UpdateCircle(); Maybe? -J [quoted text, click to view] Chris McLaughlin wrote: > 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[i][0], me.point_arr[i][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(); > */
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[i][0], me.point_arr[i][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(); */
the code below will draw a circle centered at x,y with radius r (starting at 12:00). the change the circles color, fill etc edit the code in drawF(): function circleF(x, y, r) { if (!i) { i = 1; } else { i++; } rclip = _root.createEmptyMovieClip("mc"+i, i); rclip.moveTo(x, y-r); angle = -Math.PI/2; rclip.drawI = setInterval(drawF, 10, x, y, r, rclip); } function drawF(x, y, r, mc) { trace(angle); with (mc) { lineStyle(1, 0xff0000); lineTo(x+r*Math.cos(angle), y+r*Math.sin(angle)); } angle += Math.PI/180; if (angle>=3*Math.PI/2) { clearInterval(mc.drawI); } updateAfterEvent(); }
Don't see what you're looking for? Try a search.
|