Hi all

Befor sleeping i ported nice Bezier curves from , Brian Postma...

here is the code and attached project file.

Enjoy

Befor sleeping i ported nice Bezier curves from , Brian Postma...

here is the code and attached project file.

Enjoy

B4X:

```
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim time As Timer
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim cnv As Canvas
Dim stpanel As Panel
Dim xitbtn As Button
Dim clr As Int
Dim rc As Rect
Dim angle1,angle2 As Float
angle1=0
angle2= 0
Dim xcenter,ycenter As Int
Dim radius1, radius2 As Float
Dim numdots As Int :numdots = 8 '32 Slow
Dim numpolys As Int :numpolys= 8 '16 slow
Dim x1(32),x2(32) As Int
Dim y1(32),y2(32) As Int
Dim pi As Double
'pi= 3.141592653589793238462643383279502884197
pi=cPI
Dim dangle1 As Float : dangle1=pi/128
Dim dangle2 As Float : dangle2=pi/128
'Dim t As Double
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("starscroll") 'nothing special just stpanel + exitbtn
cnv.Initialize(stpanel)
xcenter = stpanel.width / 2
ycenter = stpanel.height / 2
radius1= xcenter - 2
radius2= ycenter - 150
rc.Initialize(0,0,480,860)
time.Initialize("time",1)
time.Enabled=True
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub B1 (t As Double)
Return(t*t)
End Sub
Sub B2 (t As Double)
Return(2*t*(1-t))
End Sub
Sub B3 (t As Double)
Return((1-t)*(1-t))
End Sub
Sub time_Tick
drawCurves
End Sub
Sub drawCurves
cnv.DrawRect(rc,Colors.Black,True,2dip) ' Remplissage ecran avec couleur 0000
For i=0 To numdots-1
x1(i) = xcenter+(radius1/2) * Cos (angle1+(i)*pi*2/numdots)
y1(i) = ycenter+(radius2/2) * Sin (angle1+(i)*pi*2/numdots)
x2(i) = xcenter+(radius1) * Cos (angle2+(i)*pi*2/numdots)
y2(i) = ycenter+(radius2) * Sin (angle2+(i)*pi*2/numdots)
drawCurve(xcenter,ycenter,x1(i),y1(i),x2(i),y2(i))
Next
angle1 =angle1+ dangle1
angle2 =angle2- dangle2
stpanel.Invalidate
End Sub
Sub drawcurve(xx1,yy1,xx2,yy2,xx3,yy3)
Dim i As Double :i=0
Dim col As Int : col=255
Dim x,y As Double
Dim xold As Int
xold=xx3
yold=yy3
Do While i<1
col=col-128/numpolys
x = xx1*B1(i) + xx2*B2(i) + xx3*B3(i)
y = yy1*B1(i) + yy2*B2(i) + yy3*B3(i)
cnv.DrawLine(xold,yold,x,y,Colors.White,2dip)
xold=x
yold=y
i=i+1/numpolys
Loop
End Sub
Sub xitbtn_Click
activity.Finish
End Sub
```