[Flashnewbie] circle, counter-clockwise [SOLVED] 2004-03-15 - By Andreas Weber
Back Sweetness! Just what I needed. Thanks a bunch Darron!
For completeness sake I post the function below.
-- ---- ------ Andreas Weber motiondraw.com
radius = 100; segments = 12; c = getCircleDat(segments, radius, 'ccw'); count = 0 ;
intID = setInterval(drawCircle,500,this,c,radius); drawCircle(this, c, radius);
function getCircleDat(segments, radius, dir){ // if dir == 'ccw' the counter-clockwise coords are calculated d = []; var sgm = segments; if(dir != 'ccw'){ 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); } }else{ 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 (See http://ode-1.ora-code.com); 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)
|
|