circle, counter-clockwise 2004-03-15 - By Andreas Weber
Back More a geometry problem...
The following getCircleDat function returns the points and control-points to draw a circle. What I would like to do is to rewrite it so that it is possible to draw the circle counter-clockwise.
I added the drawing function and the interval to show why it makes a difference wether it's cw or ccw.
Thanks in advance!
-- ---- ------ Andreas Weber motiondraw.com
// paste and run
radius = 100; segments = 12; c = getCircleDat(segments, radius); count = 0 ; intID = setInterval(drawCircle,500,this,c,radius); drawCircle(this, c, radius);
function getCircleDat(segments, radius){ d = []; var sgm = segments; var periode = 2*Math.PI; var sgmAngle = periode/sgm; var cRangle = sgmAngle/2; var cRx = radius/Math.cos(cRangle); var cRy = radius/Math.cos(cRangle);
for (var angle = sgmAngle; angle<=periode+1; angle += sgmAngle) { c = {}; c._cx = Math.cos(angle-cRangle)*cRx; c._cy = Math.sin(angle-cRangle)*cRy; c._x = Math.cos(angle)*radius; c._y = Math.sin(angle)*radius; d.push(c); } return d; }
function drawCircle(mc, data, radius){ if(count == 0){ mc.lineStyle(2, 0xFF0000, 100); mc.moveTo(radius, 0); }
if(count < data.length){ mc.curveTo(data[count]._cx, data[count]._cy, data[count]._x, data[count]._y); }else{ clearInterval(intID); } count++; }
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|