Microsoft Small Basic

Program Listing:
Embed this in your website
'created by :
'Antonio Augusto Barbaro
'aabproducoes.peperonity.com
'aabproducoes.cwap.me
'facebook.com/antonio.augusto.9444023
'aaugusto444@gmail.com
'Multi Leafes Draw 0.1
'All the leafes are created using simply commands
'Very thanks to play my program
'Thanks Sb and LitDev too
GraphicsWindow.Width=400
GraphicsWindow.Height=400
GraphicsWindow.CanResize=0
GraphicsWindow.Title="Leafes Draw 0.1"
GraphicsWindow.DrawText(10,30,"Use LEFT and RIGHT to change the leafe draw")
GraphicsWindow.PenColor="Green"
GraphicsWindow.BrushColor="DarkGreen"
gw= GraphicsWindow.Width
gh= GraphicsWindow.Height
cx= gw/2
cy= gh/2
leaf_number= 9
ckd= 0
avaible= 1
GraphicsWindow.KeyDown=kd
Sub kd
  'remove all variables and arrays
  If avaible=1 Then 'verify if the draw is ended
    avaible=0
    cnt=0
    pxc=""
    pyc=""
    LDArray.Delete(px)
    LDArray.Delete(py)
    GraphicsWindow.Clear()
    If GraphicsWindow.LastKey="Left" Then
      ckd=ckd-1
      If ckd<=0 Then
        ckd=leaf_number
      EndIf
    ElseIf GraphicsWindow.LastKey="Right" then
      ckd= ckd+1
      If ckd>leaf_number then
        ckd=1
      EndIf
    EndIf
    GraphicsWindow.Title="Drawing "+ckd
    GraphicsWindow.Clear()
    If ckd=1 Then
      dl2()
    ElseIf ckd=2 then
      dl3()
    elseif ckd=3 then
      dl4()
    elseif ckd=4 then
      dl5()
    elseif ckd=5 then
      dl6()
    elseif ckd=6 then
      dl7()
    elseif ckd=7 then
      dl8()
    elseif ckd=8 then
      dl9()
    elseif ckd=9 then
      dl10()
    EndIf
    avaible=1
  EndIf
EndSub
sub dl2
  For i=1 To 20 Step 2
    ang= i*Math.Pi/10-Math.Pi/2
    pxc= cx+150*Math.Cos(ang)
    pyc= cy+150*Math.Sin(ang)
    If i<6 Or i>14 Then
      cnt=cnt+1
      px[cnt]= pxc
      py[cnt]= pyc
    EndIf
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 180/ cnt
    For i=(p*adv) To ((p*adv)+180)
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+50*Math.Cos(ang)
      pyc= py[p]+50*Math.Sin(ang)
      GraphicsWindow.BrushColor="Green"
      GraphicsWindow.FillEllipse(pxc-5,pyc-5,10,10)
      GraphicsWindow.PenColor="darkgreen"
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy+100)
    EndFor
  EndFor
EndSub
sub dl3
  For i=1 To 20 Step 2
    ang= i*Math.Pi/10-Math.Pi/2
    pxc= cx+150*Math.Cos(ang)
    pyc= cy+150*Math.Sin(ang)
    If i<6 Or i>14 Then
      cnt=cnt+1
      px[cnt]= pxc
      py[cnt]= pyc
    EndIf
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 180/ cnt
    For i=1 To 360
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+50*Math.Cos(ang)
      pyc= py[p]+50*Math.Sin(ang)
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy+100)
    EndFor
  EndFor
EndSub
sub dl4
  LDArray.Delete(px)
  For i=1 To 20 Step 2
    ang= i*Math.Pi/10-Math.Pi/2
    pxc= cx+100*Math.Cos(ang)
    pyc= cy+100*Math.Sin(ang)
    cnt=cnt+1
    px[cnt]= pxc
    py[cnt]= pyc
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 180/ cnt
    For i=1 To 360
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+20*Math.Cos(ang)
      pyc= py[p]+10*Math.Sin(ang)
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy+100)
    EndFor
  EndFor
EndSub
sub dl5
  cnt=0
  For i=1 To 20 Step 5
    ang= i*Math.Pi/10-Math.Pi/2
    pxc= cx+100*Math.Cos(ang)
    pyc= cy+100*Math.Sin(ang)
    cnt=cnt+1
    px[cnt]= pxc
    py[cnt]= pyc
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 180/ cnt
    For i=1 To 360
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+60*Math.Cos(ang)
      pyc= py[p]+60*Math.Sin(ang)
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy)
    EndFor
  EndFor
EndSub
sub dl6
  For i=1 To 10
    ang= i*Math.Pi/5-Math.Pi/2
    pxc= cx+100*Math.Cos(ang)
    pyc= cy+100*Math.Sin(ang)
    cnt=cnt+1
    px[cnt]= pxc
    py[cnt]= pyc
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 360/ cnt
    For i=(p*adv) To ((p*adv)+180)
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+60*Math.Cos(ang)
      pyc= py[p]+60*Math.Sin(ang)
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy)
    EndFor
  EndFor
EndSub
sub dl7
  For i=1 To 10
    ang= i*Math.Pi/5-Math.Pi/2
    pxc= cx+100*Math.Cos(ang)
    pyc= cy+100*Math.Sin(ang)
    cnt=cnt+1
    px[cnt]= pxc
    py[cnt]= pyc
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 360/ cnt
    For i=(p*adv-90) To ((p*adv)+90)
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+30*Math.Cos(ang)
      pyc= py[p]+30*Math.Sin(ang)
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy)
    EndFor
  EndFor
EndSub
sub dl8
  cnt=0
  For i=1 To 10
    ang= i*Math.Pi/5-Math.Pi/2
    pxc= cx+100*Math.Cos(ang)
    pyc= cy+100*Math.Sin(ang)
    cnt=cnt+1
    px[cnt]= pxc
    py[cnt]= pyc
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 360/ cnt
    For i=(p*adv-90) To ((p*adv)+90)
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+32*Math.Cos(ang)
      pyc= py[p]+32*Math.Sin(ang)
      GraphicsWindow.FillEllipse(pxc-5,pyc-5,10,10)
      GraphicsWindow.PenColor="Darkgreen"
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy)
    EndFor
  EndFor
EndSub
sub dl9
  cnt=0
  For i=1 To 20 Step 3
    ang= i*Math.Pi/10-Math.Pi/2
    pxc= cx+100*Math.Cos(ang)
    pyc= cy+100*Math.Sin(ang)
    If i<8 Or i>12 Then
      cnt=cnt+1
      px[cnt]= pxc
      py[cnt]= pyc
    EndIf
  EndFor
  GraphicsWindow.BrushColor="Green"
  For p=1 To cnt
    adv= 360/ cnt
    For i=(p*adv-90) To ((p*adv)+90)
      ang= i*Math.Pi/180-Math.Pi/2
      pxc= px[p]+32*Math.Cos(ang)
      pyc= py[p]+32*Math.Sin(ang)
      GraphicsWindow.PenColor="Darkgreen"
      GraphicsWindow.DrawLine(pxc,pyc,cx,cy)
    EndFor
  EndFor
endsub
sub dl10
  lenghtx= 30
  lenghty=50
  cx= gw/2
  cy= gh/2
  px1= cx
  py1= 100
  px2= cx
  py2= 250
  GraphicsWindow.PenColor="Green"
  dx= (px2-px1)/100
  dy= (py2-py1)/100
  For i=1 To 100 Step 2
    px= dx*i+px1
    py= dy*i+py1
    GraphicsWindow.DrawLine(px,py,px-i,py-lenghty+i)
    GraphicsWindow.DrawLine(px,py,px+i,py-lenghty+i)
  EndFor
EndSub

Copyright (c) Microsoft Corporation. All rights reserved.