Small Basic: Shapes
This article is about Shapes object in Microsoft Small Basic programming language.
Type of Shapes
There are following 5 types of Shapes.
- Ellipse
- Image
- Line
- Rectangle
- Triangle
Special Features
Comparing to GraphicsWindow.DrawXXX
or GraphicsWindow.FillXXX
, Shapes object has following six special features.
- Movable
- Rotatable
- Zoomable
- Can Be Transparent
- Hidable
- Removable
Movable
There are two operations to move a shape - Shapes.Animate()
and Shapes.Move()
.
GraphicsWindow.BrushColor = "Cyan"
GraphicsWindow.PenWidth = 4
GraphicsWindow.PenColor = "DarkCyan"
shp = Shapes.AddRectangle(200, 100)
Shapes.Animate(shp, 200, 200, 2000)
Program.Delay(2000)
Shapes.Move(shp, 300, 200)
Rotatable
A shape is rotatable with Shapes.Rotate()
operation.
Shapes.Rotate(shp, 45)
Zoomable
A shape is zoomable with Shapes.Zoom()
operation.
For scale = 0.1 To 2 Step 0.1
Shapes.Zoom(shp, scale, scale)
Program.Delay(500)
EndFor
Can Be Transparent
A shape can be transparent with Shapes.SetOpacity()
operation.
For opacity = 100 To 10 Step -10
Shapes.SetOpacity(shp, opacity)
Program.Delay(500)
EndFor
Hidable
A shape is hidable with Shapes.HideShape()
operation. And also be shown with Shapes.ShowShape()
operation.
Shapes.HideShape(shp)
Program.Delay(1000)
Shapes.ShowShape(shp)
Program.Delay(1000)
Removable
A shape is removable with Shapes.Remove()
operation.
Shapes.Remove(shp)