# Drawing curves, efficiency?

**URL:** <https://forum.kirupa.com/t/drawing-curves-efficiency/223212>\
**Category:** flash\
**Created:** [April 20, 2007, 10:15am UTC](https://forum.kirupa.com/t/drawing-curves-efficiency/223212 "2007-04-20T10:15:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iamthejuggler](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@Iamthejuggler](https://forum.kirupa.com/u/Iamthejuggler)\
**Post date:** [April 20, 2007, 10:15am UTC](https://forum.kirupa.com/t/drawing-curves-efficiency/223212/1 "2007-04-20T10:15:45Z")

</div>

Hi, I’ve been having fun making these curve generating movies such as this one:  
[http://www.walkingbaby.co.uk/experiments/spiderdraw4.html](http://www.walkingbaby.co.uk/experiments/spiderdraw4.html)

The problem I am having is that after they get more detailed they start slowing down considerably. Does anyone have any suggestions as to how i can make it more efficient?

This is how I am currently doing it:

```auto
this.createEmptyMovieClip("curve",1);
curve.xPoint = Stage.width/2;
curve.yPoint = Stage.height/2;
curve.xPointA = Stage.width/2;
curve.yPointA = Stage.height/2;
curve.onMouseMove = function(){
with(this){
    if(Key.isDown(Key.ENTER)){
    //colour = Math.random() * 16581375;
    colour = 0x555555;
    lineStyle(3, colour, 10);
    moveTo(xPointA,yPoint);
    curveTo(_xmouse,_ymouse,xPointA,yPointA);
    //curveTo(Stage.width-_xmouse,_ymouse,xPointA,_xmouse);
    endFill();}
    xPoint = _xmouse;
    yPoint = _ymouse;
    //this.xPointA+= (0.5-Math.random())*10;
    
    this.yPointA+= (0.5-Math.random())*30;
    if (yPointA > Stage.height) yPointA = Stage.height;
    if (yPointA < 0) yPointA = 0;
}
}

this.onMouseDown = function(){
    curve.clear();
}

```

Thanks.
