none
miangul November 2016 RRS feed

  • Question

  • hello everybody i have been making a program animals animation for some time i was getting help from you gurus and from small basic tutorials and forum but was always confussed i think and it is my humble opinion only i am getting somewhere now and i am posting a program  ID BZF497 if you you edit it and if it is any good in you opinion i shall procced with the color and the grapicswindow.drawLine and the drawTriangle section which need changes with love

                                    thankyou

                           mahreen miangul mussa-maina

    Tuesday, November 1, 2016 12:01 PM

Answers

  • mussamaina

    See BZF497-0  If you want to draw rectangle,triangle, line,  you must add if ... then  else ... endif  code.(below)

    (1)Shape type

    If shape[i]["func"]="ell" Then 
        shp[i] = Shapes.AddEllipse(shape[i]["width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="rect" Then 
        shp[i] = Shapes.AddRectangle(shape[i]["width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="tri" Then
        shp[i] = Shapes.Addtriangle(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s, shape[i]["x3"]*s, shape[i]["y3"]*s)
      ElseIf shape[i]["func"]="line" Then
        shp[i] = Shapes.Addline(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s)
      EndIf
     

    (2)Draw type

     If  shape[i]["func"]="ell" Then
        GraphicsWindow.DrawEllipse(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s)
      elseIf shape[i]["func"]="rect" Then
        GraphicsWindow.DrawRectangle(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="tri" then
        GraphicsWindow.DrawTriangle(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s,shape[i]["x"]*s+shape[i]["x3"]*s, shape[i]["y"]*s+shape[i]["y3"]*s )
      elseif shape[i]["func"]="line" then
        GraphicsWindow.Drawline(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s )
      EndIf

    *Note: Draw type... triangle and line X,Y positions differ from shape type's.   underlined.

    (3)sample  ...  Use triangle,rectangle,ellipse shapes.

     Triangle shape can be drawn in two ways.  

    case1()
    Program.Delay(1000)
    Shapes.Animate(tri,300,20,2000)
    Program.Delay(2000)
    case2()

    Sub case1
      GraphicsWindow.BrushColor="#F39800"
      rect1=Shapes.AddRectangle(10,270)
      Shapes.Move(rect1,105,90)
      GraphicsWindow.BrushColor="#F8E58C"
      tri= Shapes.AddTriangle(50,0,0,100,100,100)
      Shapes.SetOpacity(tri,50)
      Shapes.Move(tri,60,20)
      GraphicsWindow.BrushColor="#84A2D4"
      ell= Shapes.AddEllipse(80,60)
      Shapes.Move(ell,70,130)
      GraphicsWindow.BrushColor="#928178"
      rect2= Shapes.AddRectangle(120,70)
      Shapes.Move(rect2,50,200)
    EndSub

    Sub case2
       GraphicsWindow.BrushColor="#F8E58C"
      tri2= Shapes.AddTriangle(110,20,60,120,160,120)  '<------- Triangle is made at same position
      Shapes.SetOpacity(tri2,50)
    EndSub

    (4)sample  ...  Use line shapes.

     Line shape can be drawn in three ways.  

    GraphicsWindow.PenColor="Red"
    line[1]=Shapes.AddLine(0,0,0,200)   '   Straight line
    Shapes.Move(line[1],150,100)
    Shapes.Rotate(line[1],30)                '  rotate it 30 degrees
    GraphicsWindow.PenColor="Blue"
    line[2]=Shapes.AddLine(100,0,0,173)  'Diagonal lines
    Shapes.Move(line[2],100,100+(100-173.2/2))  '  sqrt(3)=1.732  move it at X,Y=(100,100+(100-173.2/2))
    GraphicsWindow.PenColor="Green"
    line[3]=Shapes.AddLine(200,100+(100-173.2/2),100,100+(100-173.2/2)+173)  ' make line at X1,Y1,X2,Y2=(200,100+(100-173.2/2),100,100+(100-173.2/2)+173

    Program.Delay(1000)
    Shapes.Animate(line[1],400,100,2000)
    Program.Delay(2000)
    Shapes.Animate(line[2],250,100+(100-173.2/2),2000)
    Program.Delay(2000)


    Wednesday, November 2, 2016 3:12 AM
    Answerer

All replies

  • Hello mussamaina, I love your animation program.  Thanks.

    Nonki Takahashi

    Tuesday, November 1, 2016 2:18 PM
    Moderator
  • mussamaina

    See BZF497-0  If you want to draw rectangle,triangle, line,  you must add if ... then  else ... endif  code.(below)

    (1)Shape type

    If shape[i]["func"]="ell" Then 
        shp[i] = Shapes.AddEllipse(shape[i]["width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="rect" Then 
        shp[i] = Shapes.AddRectangle(shape[i]["width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="tri" Then
        shp[i] = Shapes.Addtriangle(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s, shape[i]["x3"]*s, shape[i]["y3"]*s)
      ElseIf shape[i]["func"]="line" Then
        shp[i] = Shapes.Addline(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s)
      EndIf
     

    (2)Draw type

     If  shape[i]["func"]="ell" Then
        GraphicsWindow.DrawEllipse(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s)
      elseIf shape[i]["func"]="rect" Then
        GraphicsWindow.DrawRectangle(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="tri" then
        GraphicsWindow.DrawTriangle(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s,shape[i]["x"]*s+shape[i]["x3"]*s, shape[i]["y"]*s+shape[i]["y3"]*s )
      elseif shape[i]["func"]="line" then
        GraphicsWindow.Drawline(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s )
      EndIf

    *Note: Draw type... triangle and line X,Y positions differ from shape type's.   underlined.

    (3)sample  ...  Use triangle,rectangle,ellipse shapes.

     Triangle shape can be drawn in two ways.  

    case1()
    Program.Delay(1000)
    Shapes.Animate(tri,300,20,2000)
    Program.Delay(2000)
    case2()

    Sub case1
      GraphicsWindow.BrushColor="#F39800"
      rect1=Shapes.AddRectangle(10,270)
      Shapes.Move(rect1,105,90)
      GraphicsWindow.BrushColor="#F8E58C"
      tri= Shapes.AddTriangle(50,0,0,100,100,100)
      Shapes.SetOpacity(tri,50)
      Shapes.Move(tri,60,20)
      GraphicsWindow.BrushColor="#84A2D4"
      ell= Shapes.AddEllipse(80,60)
      Shapes.Move(ell,70,130)
      GraphicsWindow.BrushColor="#928178"
      rect2= Shapes.AddRectangle(120,70)
      Shapes.Move(rect2,50,200)
    EndSub

    Sub case2
       GraphicsWindow.BrushColor="#F8E58C"
      tri2= Shapes.AddTriangle(110,20,60,120,160,120)  '<------- Triangle is made at same position
      Shapes.SetOpacity(tri2,50)
    EndSub

    (4)sample  ...  Use line shapes.

     Line shape can be drawn in three ways.  

    GraphicsWindow.PenColor="Red"
    line[1]=Shapes.AddLine(0,0,0,200)   '   Straight line
    Shapes.Move(line[1],150,100)
    Shapes.Rotate(line[1],30)                '  rotate it 30 degrees
    GraphicsWindow.PenColor="Blue"
    line[2]=Shapes.AddLine(100,0,0,173)  'Diagonal lines
    Shapes.Move(line[2],100,100+(100-173.2/2))  '  sqrt(3)=1.732  move it at X,Y=(100,100+(100-173.2/2))
    GraphicsWindow.PenColor="Green"
    line[3]=Shapes.AddLine(200,100+(100-173.2/2),100,100+(100-173.2/2)+173)  ' make line at X1,Y1,X2,Y2=(200,100+(100-173.2/2),100,100+(100-173.2/2)+173

    Program.Delay(1000)
    Shapes.Animate(line[1],400,100,2000)
    Program.Delay(2000)
    Shapes.Animate(line[2],250,100+(100-173.2/2),2000)
    Program.Delay(2000)


    Wednesday, November 2, 2016 3:12 AM
    Answerer
  • thanking all members and gurus

                                  from mussa-maina with love

                                             mahreen miangul

    Wednesday, November 2, 2016 5:15 AM