# New Movieclip()

## You want to draw Cubic Bezier curves in Flash?

If you want to draw some cubic Bezier curves in Flash, at the moment it is not really possible. That’s the reason why I did some search work to find a good way to really draw some cubic beziercurves in Flash. I good starting point is (as most of the time ) Wikipedia (which was in our Belgium news today). The article I want to point is located at http://en.wikipedia.org/wiki/Bezier_curve .

Bézier curves were widely publicised in 1962 by the French engineer Pierre Bézier, who used them to design automobile bodies.

There are several methods to draw a Cubic bezier curve in Flash as explained into  this (old) article: http://timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm

I made some example application where I use the following expression to calculate the cubic bezier curve . I do this for the X and Y coordinate of the point on the curve.

$\mathbf{B}(t)=\mathbf{P}_0(1-t)^3+3\mathbf{P}_1t(1-t)^2+3\mathbf{P}_2t^2(1-t)+\mathbf{P}_3t^3 \mbox{ , } t \in [0,1].$

I made some code example similar to the wikipedia C++ example in actionscript wich you can download here. It is made for clarity and can be a lot more optimized.  If you have questions about it, feel free to comment about it !

UPDATE : I forgot to mention the example is build in the new FlashDevelop 2.0.2 and it all went very smooth, thanx to the FlashDevelop team to build such a wonderfull tool 😉

cheers

koen

### 13 responses to “You want to draw Cubic Bezier curves in Flash?”

1. Michael Yesutin 29 December , 2006 at 5:37 am

You get to the studies Russian programmers Ivan Dembicki and Alexander Sergeev. http://www.bezier.ru/

2. Koen 29 December , 2006 at 11:01 am

cool, I have to study Russian language 🙂 I Did not know about their site but it is very interesting.

3. Benoit 'Raz-L' Jadinon 29 December , 2006 at 11:05 am

hi, i did a bezier class too, some time ago, if you want to check it :
http://www.raz-l.com/brol/bezier.zip

4. Wouter 29 December , 2006 at 12:05 pm

Hey Koen,

I needed quadratic curves a while ago and found a good AS2 class here:

http://www.alex-uhlmann.de/flash/animationpackage/

It contains com.robertpenner.bezier.CubicCurve, which is (hence the package name) a port from Robert Penners as1 bezier drawing functions…

5. sumantra dam 5 March , 2007 at 7:24 pm

determine the cubic bezier curve that would be formed with the following control points
T1(0,40),T2(40,40),T3(60,20)and T4(60,0).Daw a rough sketch of the curve

It is proposed to draw another curve which meets the above curve smoothly.
Suggest a set of 4 control points that would carry out the job.

6. zapalyt 18 December , 2007 at 8:59 am

izvenite no nam nado sdelat test
vi ved ne bydete protiv admini

7. binod singh 13 May , 2008 at 12:12 pm

Hi, Can u please give me some hint about drawing cubic bezier curve in flash…

8. ecards 30 August , 2008 at 1:35 am

Is there any way possible to use NURBS instead of bezier, being that then the control point can be made to always stay on the curve?

Thank you,
LTG

9. BalBleard 2 December , 2008 at 1:02 am

Убежден, вышла заметка

10. DyenlyDem 7 December , 2008 at 10:13 pm

Ура!, афтар грамотно накреативил.

11. ArreptPepaY 15 January , 2009 at 9:25 am

Афтар респект

12. Shawn 24 September , 2014 at 6:54 am

I read a lot of interesting articles here.
Probably you spend a lot of time writing, i know
how to save you a lot of time, there is an online tool that creates unique,