hola
tengo un problema con un script de as2.
El script dibuja un circulo como si fuera dibujado por un compas, el unico problema es que no tiene la velocidad adecuada.
Podrian ayudarme?
El script:
Código:
MovieClip.prototype.drawWedge = function(x, y, startAngle, arc, radius, yRadius) {
// mc.drawWedge() - by Ric Ewing (ric@formequalsfunction.com) - version 1.3 - 6.12.2002
// Modified under permission (lol) by TheOm3ga
var x = 251
var y = 221
var startAngle = 180
var radius = 166.3
var yradius = 166.3
if (arguments.length<5) {
return;
}
this.moveTo(x, y);
if (yRadius == undefined) {
yRadius = radius;
}
var segAngle, theta, angle, angleMid, segs, ax, ay, bx, by, cx, cy;
if (Math.abs(arc)>360) {
arc = 360;
}
segs = Math.ceil(Math.abs(arc)/45);
segAngle = arc/segs;
theta = -(segAngle/180)*Math.PI;
angle = -(startAngle/180)*Math.PI;
if (segs>0) {
ax = x+Math.cos(startAngle/180*Math.PI)*radius;
ay = y+Math.sin(-startAngle/180*Math.PI)*yRadius;
this.lineTo(ax, ay);
this.lineStyle(1,0xff0000,100);
for (var i = 0; i<segs; i++) {
angle += theta;
angleMid = angle-(theta/2);
bx = x+Math.cos(angle)*radius;
by = y+Math.sin(angle)*yRadius;
cx = x+Math.cos(angleMid)*(radius/Math.cos(theta/2));
cy = y+Math.sin(angleMid)*(yRadius/Math.cos(theta/2));
this.curveTo(cx, cy, bx, by);
}
this.lineStyle(0,0x000000,0);
this.lineTo(x, y);
}
};
_root.createEmptyMovieClip("circulo",1);
_root.circulo.angulo = 0;
_root.circulo.onEnterFrame = function(){
if(_root.circulo.angulo<360){
_root.circulo.angulo--;
}else{
delete this.onEnterFrame;
}
this.clear();
this.drawWedge(50,50,90,this.angulo,50);
}