Small Basic Reference Documentation: Shapes Object
Small Basic: Reference Documentation > Shapes
http://smallbasic.com/img/object_32.png
Shapes
The Shape object allows you to add, move and rotate shapes to the Graphics window.
Operations
http://smallbasic.com/img/method_16.png AddRectangle
Shapes.AddRectangle(width, height)
Adds a rectangle shape with the specified width and height.
width
The width of the rectangle shape.
height
The height of the rectangle shape.
Returns
The Rectangle shape that was just added to the Graphics Window.
http://smallbasic.com/img/method_16.png AddEllipse
Shapes.AddEllipse(width, height)
Adds an ellipse shape with the specified width and height.
width
The width of the ellipse shape.
height
The height of the ellipse shape.
Returns
The Ellipse shape that was just added to the Graphics Window.
http://smallbasic.com/img/method_16.png AddTriangle
Shapes.AddTriangle(x1, y1, x2, y2, x3, y3)
Adds a triangle shape represented by the specified points.
x1
The x co-ordinate of the first point.
y1
The y co-ordinate of the first point.
x2
The x co-ordinate of the second point.
y2
The y co-ordinate of the second point.
x3
The x co-ordinate of the third point.
y3
The y co-ordinate of the third point.
Returns
The Triangle shape that was just added to the Graphics Window.
http://smallbasic.com/img/method_16.png AddLine
Shapes.AddLine(x1, y1, x2, y2)
Adds a line between the specified points.
x1
The x co-ordinate of the first point.
y1
The y co-ordinate of the first point.
x2
The x co-ordinate of the second point.
y2
The y co-ordinate of the second point.
Returns
The line that was just added to the Graphics Window.
http://smallbasic.com/img/method_16.png AddImage
Shapes.AddImage(imageName)
Adds an image as a shape that can be moved, animated or rotated.
imageName
The name of the image to draw.
Returns
The image that was just added to the Graphics Window.
http://smallbasic.com/img/method_16.png AddText
Shapes.AddText(text)
Adds some text as a shape that can be moved, animated or rotated.
text
The text to add.
Returns
The text shape that was just added to the Graphics Window.
http://smallbasic.com/img/method_16.png SetText
Shapes.SetText(shapeName, text)
Sets the text of a text shape.
shapeName
The name of the text shape.
text
The new text value to set.
Returns
Nothing
http://smallbasic.com/img/method_16.png Remove
Shapes.Remove(shapeName)
Removes a shape from the Graphics Window.
shapeName
The name of the shape that needs to be removed.
Returns
Nothing
http://smallbasic.com/img/method_16.png Move
Shapes.Move(shapeName, x, y)
Moves the shape with the specified name to a new position.
shapeName
The name of the shape to move.
x
The x co-ordinate of the new position.
y
The y co-ordinate of the new position.
Returns
Nothing
http://smallbasic.com/img/method_16.png Rotate
Shapes.Rotate(shapeName, angle)
Rotates the shape with the specified name to the specified angle.
shapeName
The name of the shape to rotate.
angle
The angle to rotate the shape.
Returns
Nothing
http://smallbasic.com/img/method_16.png Zoom
Shapes.Zoom(shapeName, scaleX, scaleY)
Scales the shape using the specified zoom levels. Minimum is 0.1 and maximum is 20.
shapeName
The name of the shape to rotate.
scaleX
The x-axis zoom level.
scaleY
The y-axis zoom level.
Returns
Nothing
http://smallbasic.com/img/method_16.png Animate
Shapes.Animate(shapeName, x, y, duration)
Animates a shape with the specified name to a new position.
shapeName
The name of the shape to move.
x
The x co-ordinate of the new position.
y
The y co-ordinate of the new position.
duration
The time for the animation, in milliseconds.
Returns
Nothing
http://smallbasic.com/img/method_16.png GetLeft
Shapes.GetLeft(shapeName)
Gets the left co-ordinate of the specified shape.
shapeName
The name of the shape.
Returns
The left co-ordinate of the shape.
http://smallbasic.com/img/method_16.png GetTop
Shapes.GetTop(shapeName)
Gets the top co-ordinate of the specified shape.
shapeName
The name of the shape.
Returns
The top co-ordinate of the shape.
http://smallbasic.com/img/method_16.png GetOpacity
Shapes.GetOpacity(shapeName)
Gets the opacity of a shape.
shapeName
The name of the shape.
Returns
The opacity of the object as a value between 0 and 100. 0 is completely transparent and 100 is completely opaque.
http://smallbasic.com/img/method_16.png SetOpacity
Shapes.SetOpacity(shapeName, level)
Sets how opaque a shape should render.
shapeName
The name of the shape.
level
The opacity level ranging from 0 to 100. 0 is completely transparent and 100 is completely opaque.
Returns
Nothing
http://smallbasic.com/img/method_16.png HideShape
Shapes.HideShape(shapeName)
Hides an already added shape.
shapeName
The name of the shape.
Returns
Nothing
http://smallbasic.com/img/method_16.png ShowShape
Shapes.ShowShape(shapeName)
Shows a previously hidden shape.
shapeName
The name of the shape.
Returns
Nothing
See Also
- Small Basic: Reference Documentation
- The Developer’s Reference Guide to Small Basic
- Wiki: Small Basic Portal