# Need help animating lines using lineTo function

**URL:** <https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642>\
**Category:** Uncategorized\
**Created:** [August 16, 2003, 1:16am UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642 "2003-08-16T01:16:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![littlegrasshopp](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@littlegrasshopp](https://forum.kirupa.com/u/littlegrasshopp)\
**Post date:** [August 16, 2003, 1:16am UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/1 "2003-08-16T01:16:46Z")

</div>

I would like to animate creating a box using using the built in function of movieclip.lineTo() function. I know how to draw the lines but they don’t animate like I want. They just appear went I run the code. I want the top line to draw first from a length of 0 pixels to 200 pixels and same with the sides.

If anyone has clues on how to do this…it would be greatly appreciated.🙂

What would even be better is a sample code of some sort 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 12:38pm UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/2 "2003-08-16T12:38:35Z")

</div>

[http://proto.layer51.com/d.aspx?f=952](http://proto.layer51.com/d.aspx?f=952)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 6:10pm UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/3 "2003-08-16T18:10:54Z")

</div>

thanks for the link 🙂 It’s a great tutorial but what I want to do is instead of drawing a box by myself in the flash program, i want to draw it with

```auto
 and have it animatedly draw if that makes sense. I see a lot of people have boxes coming down/getting bigger and so forth on their site but i want to actually have a box drawn dynmically that is animated too! i.e. a box that just doesn't appear drawn but shows each side lengthing into a box.
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2003, 11:27pm UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/4 "2003-08-16T23:27:07Z")

</div>

I remember seeing a tutorial on this, but I can’t seem to find it. Go to this site [http://www.bit-101.com](http://www.bit-101.com). There are a lot of cool examples here and you can DL the source. Find one that applies and look at the source.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 17, 2003, 12:11am UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/5 "2003-08-17T00:11:11Z")

</div>

I can make a line grow, but I don’t know enough about API to make a box. For instance - you could do this:

```auto

_root.createEmptyMovieClip("holder", 0);
xspeed = 100;
yspeed = 100;
this.onEnterFrame = function () {
this.xspeed += 2;
this.yspeed += 2;
holder.lineStyle(2, 0xFF0000, 100);
holder.moveTo(100, 100);
holder.lineTo(this.xspeed, this.yspeed);
};

```

So that draws a line across the screen diagonally. I haven’t learned the curveTo thing. Maybe that’ll get you started or give someone else an idea. Good luck!!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 17, 2003, 1:06am UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/6 "2003-08-17T01:06:51Z")

</div>

did you even go to the link?

[swf=“[http://userpages.umbc.edu/~tmccau1/flash/layer51/drawpath.swf](http://userpages.umbc.edu/~tmccau1/flash/layer51/drawpath.swf) height=200 width=300”][/swf]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 17, 2003, 5:51am UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/7 "2003-08-17T05:51:22Z")

</div>

Sorry Senocular…didn’t look at the tutorial in that way. I thought it was a clever way of creating predetermined paths for movies to follow. I now can see what you are saying…Thanks a lot. Big help!!

Hey Freddythunder…nice footer! Got me to thinking about doing something along those lines on my site 🙂

Thanks again guys for all the help…still a little grasshopper when it comes to flash.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 18, 2003, 2:04pm UTC](https://forum.kirupa.com/t/need-help-animating-lines-using-lineto-function/28642/8 "2003-08-18T14:04:33Z")

</div>

Thanks, I wanted it to repeat forever, but it got a little processor intensive so I had to stop it at like 400 or something, don’t remember…
