ArcCircle
Create an ArcCircle, part of a circle around a center and radius.
ArcCircles are like Arcs, but shaped from a circle instead of an oval. They look like Circles, except only the section from startAngle to endAngle is visible.
Creating an ArcCircle
You can create an ArcCircle using the following functions:
ArcCircle(x, y, radius)
ArcCircle(x, y, radius, startAngle, endAngle, style, color, fill, thickness, rotation, visibility)
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
int or float |
required | The horizontal position of the center, in pixels. |
y |
int or float |
required | The vertical position of the center, in pixels. |
radius |
int or float |
required | The radius, in pixels. |
startAngle |
int or float |
PI |
The starting angle, in degrees. |
endAngle |
int or float |
TWO_PI |
The ending angle, in degrees. |
style |
int |
OPEN |
The arc style, one of OPEN (an open arc), CHORD (closed with a straight line between the ends), or PIE (closed with two lines to the center). |
color |
Color |
Color.BLACK |
The color. |
fill |
bool |
False |
Whether the arc is filled in (True) or just an outline (False). |
thickness |
int |
1 |
The outline thickness, in pixels. |
rotation |
int or float |
0 |
How far to turn the arc, in degrees, counter-clockwise. |
visibility |
int |
100 |
How visible the arc is, from 0 (invisible) to 100 (fully visible). |
For example,
arc = ArcCircle(100, 100, 20, 0, 180)
Once created, you can add it to a Display using the Display's add() function.
Functions
Once an ArcCircle arc has been created, the following functions are available:
Position
| Function | Description |
|---|---|
arc.getPosition() |
Return the object's position, the top-left corner of its bounding box. |
arc.getX() |
Return the object's horizontal position. |
arc.getY() |
Return the object's vertical position. |
arc.getCenter() |
Return the object's center point. |
arc.getCenterX() |
Return the object's horizontal center. |
arc.getCenterY() |
Return the object's vertical center. |
arc.setPosition(x, y) |
Move the object so the top-left corner of its bounding box sits at the given point. |
arc.setX(x) |
Set the object's horizontal position. |
arc.setY(y) |
Set the object's vertical position. |
arc.setCenter(x, y) |
Move the object so its center sits at the given point. |
arc.setCenterX(x) |
Set the object's horizontal center. |
arc.setCenterY(y) |
Set the object's vertical center. |
arc.move(x, y) |
Move the object to a new position. |
Size
| Function | Description |
|---|---|
arc.getSize() |
Return the object's width and height. |
arc.getWidth() |
Return the object's width. |
arc.getHeight() |
Return the object's height. |
arc.getRadius() |
Return the object's radius. |
arc.setSize(width, height) |
Set the object's size. |
arc.setWidth(width) |
Set the object's width. |
arc.setHeight(height) |
Set the object's height. |
arc.setRadius(radius) |
Set the object's radius. |
Rotation
| Function | Description |
|---|---|
arc.getRotation() |
Return how far the object is turned. |
arc.setRotation(rotation) |
Turn the object to a given angle. |
arc.rotate(angle) |
Turn the object by an additional angle. |
Visibility
| Function | Description |
|---|---|
arc.getVisibility() |
Return how visible the object is. |
arc.setVisibility(visibility) |
Set how visible the object is. |
Color
| Function | Description |
|---|---|
arc.getColor() |
Return the shape's color. |
arc.getFill() |
Report whether the shape is filled in. |
arc.getThickness() |
Return the shape's outline thickness. |
arc.setColor() |
Set the shape's color. |
arc.setFill(fill) |
Set whether the shape is filled in. |
arc.setThickness(thickness) |
Set the shape's outline thickness. |
Information
| Function | Description |
|---|---|
arc.getEndpoints() |
Return the object's four corners. |
arc.getBoundingBox() |
Return the smallest upright box that surrounds the object. |
arc.getGroup() |
Return the Group this object belongs to. |
arc.getDisplay() |
Return the Display this object is on. |
arc.setToolTipText() |
Set the hover text shown over the object. |
Hit Testing
| Function | Description |
|---|---|
arc.intersects(other) |
Report whether this circle overlaps another object. |
arc.contains(x, y) |
Report whether a point lies inside the object. |
arc.encloses(other) |
Report whether this object completely contains another. |
Events
| Function | Description |
|---|---|
arc.onMouseClick(action) |
Set up a function to call when the mouse is clicked on this object. |
arc.onMouseDown(action) |
Set up a function to call when the mouse button is pressed on this object. |
arc.onMouseUp(action) |
Set up a function to call when the mouse button is released over this object. |
arc.onMouseMove(action) |
Set up a function to call when the mouse moves over this object. |
arc.onMouseDrag(action) |
Set up a function to call when the mouse is dragged over this object. |
arc.onMouseEnter(action) |
Set up a function to call when the mouse moves onto this object. |
arc.onMouseExit(action) |
Set up a function to call when the mouse moves off this object. |
arc.onKeyType(action) |
Set up a function to call when a key is typed (pressed and released). |
arc.onKeyDown(action) |
Set up a function to call when a key is pressed down. |
arc.onKeyUp(action) |
Set up a function to call when a key is released. |