# Formula for a curve using "graphics.curveTo"

**URL:** <https://forum.kirupa.com/t/formula-for-a-curve-using-graphics-curveto/319284>\
**Category:** flash\
**Created:** [February 15, 2011, 1:53pm UTC](https://forum.kirupa.com/t/formula-for-a-curve-using-graphics-curveto/319284 "2011-02-15T13:53:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidanmack](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@aidanmack](https://forum.kirupa.com/u/aidanmack)\
**Post date:** [February 15, 2011, 1:53pm UTC](https://forum.kirupa.com/t/formula-for-a-curve-using-graphics-curveto/319284/1 "2011-02-15T13:53:28Z")

</div>

Hi guys,  
I’m using…

“mc.graphics.moveTo”  
and…  
mc.graphics.curveTo

…to draw out some dynamic lines.

What I want it do is always create the curve in the middle of the line and at an equal distance away from the line.

But the x,y position of the start and finish of these lines could be anything

What I need is some sort of equation that sets the “controlX” and “controlY”  
depending on how long the line is and in what position it is.

…Anyone got any ideas for that?

Thanks  
Aidan

The below is a pile of pap and doesnt actually work… but thats me trying to figure out some set equation for it…

```auto

lineForItem.graphics.moveTo(childDisplay.x, childDisplay.y);
			
var newB:int = familyData.mumsY - childDisplay.y / 2			
var newA:int = familyData.mumsA - childDisplay.A / 2
lineForItem.graphics.curveTo(familyData.mumsX + newA, familyData.mumsY + newB, familyData.mumsX, familyData.mumsY);

```
