Circle..drawing by script..How ? please

Hi,

please check the attchmnt.

With this i want to get just a circle drawing effect.
First draw outer circle, then draw second inner circle and last third inner circle.

thats all

Please give me some solutions

Check out this super cool prototype written by our very own Senocular :slight_smile:

http://proto.layer51.com/d.aspx?f=952

:hr:

Hi,

thanks for you link. its an excellent stuff.

But Sorry, i am not that much programmer guy.
may be i posted in a not proper place.

can you give me any more simple thing.

or if you dont mind an FLA .

I would be greatful …

just copy/paste this on the first frame

MovieClip.prototype.drawCircle = function(xpos, ypos, radius, lWidth, lColor) {
x = xpos;
y = ypos;
r = radius;
u = r0.4086;
v = r
0.7071;
this.lineStyle(lwidth, lColor, 100);
this.moveTo(x-r, y);
this.curveTo(x-r, y-u, x-v, y-v);
this.curveTo(x-u, y-r, x, y-r);
this.curveTo(x+u, y-r, x+v, y-v);
this.curveTo(x+r, y-u, x+r, y);
this.curveTo(x+r, y+u, x+v, y+v);
this.curveTo(x+u, y+r, x, y+r);
this.curveTo(x-u, y+r, x-v, y+v);
this.curveTo(x-r, y+u, x-r, y);
};
for (i=1; i<4; i++) {
createEmptyMovieClip(“paper”+i, i);
}
paper1.drawcircle(300, 200, 40, 1, 0x0000);
paper2.drawcircle(300, 200, 60, 1, 0x0000);
paper3.drawcircle(300, 200, 80, 1, 0x0000);

Hi,

I copy/pasted in the first frame…
but nothing to see… in stage
Have I to change any parameters ?


MovieClip.prototype.drawCircle = function(xpos, ypos, radius, lWidth, lColor) {
x = xpos;
y = ypos;
r = radius;
u = r0.4086;
v = r
0.7071;
this.lineStyle(lwidth, lColor, 100);
this.moveTo(x-r, y);
this.curveTo(x-r, y-u, x-v, y-v);
this.curveTo(x-u, y-r, x, y-r);
this.curveTo(x+u, y-r, x+v, y-v);
this.curveTo(x+r, y-u, x+r, y);
this.curveTo(x+r, y+u, x+v, y+v);
this.curveTo(x+u, y+r, x, y+r);
this.curveTo(x-u, y+r, x-v, y+v);
this.curveTo(x-r, y+u, x-r, y);
};
for (i=1; i<4; i++) {
createEmptyMovieClip(“paper”+i, i);
}
paper1.drawcircle(300, 200, 40, 1, 0x0000);
paper2.drawcircle(300, 200, 60, 1, 0x0000);
paper3.drawcircle(300, 200, 80, 1, 0x0000);[/QUOTE]

[/QUOTE]

no, it works as it is.2 different ways here.

Small typos I guess, watch the capitals;)
in paper1.drawcircle(etc) should be a capital C (and 0x000000)
in this.lineStyle(lwidth, lColor, 100), capital W.

scotty(-:

probably

In the second dynamic function i have drawn them the wrong way round small to large, just change to
myfunction = function () {
clearInterval(myInterval);
_root[“paper”+k].drawcircle(80+L, 100, 200, 10);
k++;
L -= 20;
};
http://www.gifsrus.com/testfile/drawcircle.swf

if you want to use the first just put in a setInterval so that outer is first etc

if you use the code from the link originally posted, you could use this script to make it work:

// ActionScript:
createEmptyMovieClip("circles", 1); // create clip to draw in
circles._x = circles._y = 150; // position it

myPath = new Path(); // create Path
myPath.moveTo(-50,0).circleTo(50,0).circleTo(-50,0); // inner circle
myPath.moveTo(-70,0).circleTo(70,0).circleTo(-70,0); // middle circle
myPath.moveTo(-90,0).circleTo(90,0).circleTo(-90,0); // outer circle

circles.percent = 0; // set percentage of drawing complete
circles.speed = 0.01; // speed of percentage increase
circles.onEnterFrame = function(){
	this.percent += this.speed; // increase percent
	if (this.percent > 1) this.percent = 1; // dont let go beyond 100% (percent == 1)
	this.clear(); // refresh drawing of this movie clip
	this.lineStyle(1,0,100); // reset the linestyle
	myPath.drawUpTo(this, this.percent); // draw the path in this movieclip up to percent
	if (this.percent == 1) delete this.onEnterFrame; // if 100%, remove onEnterFrame
}

Hi,

this._problemSolved(“true”)

Thanks for you all guys.
Esp. for senocular…your code works fine.

best regards
Nasih

welcome :wink: