Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
circle, counter-clockwise

circle, counter-clockwise

2004-03-15       - By Andreas Weber

 Back
Reply:     1     2     3     4     5  

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)