Skip to content
Jesper Sørensen edited this page Sep 7, 2014 · 1 revision

Class: Circle

Circle

A math class which is used for handling circles

new Circle(x, y, radius)

Constructor for Circle class, uses the set function, to set the properties of the circle.

Parameters:
Name Type Description
x number

The x-coordinate for the center of the circle

y number

The y-coordinate for the center of the circle

radius number

The radius for the circle

Properties:
Name Type Description
x number

The circle's horizontal position

y number

The circle's vertical position

radius number

The circle's radius

Source:

Extends

Methods

animate(properties, options)

Used for animating numeric properties of the owner of the function. Available easing functions are: "linear" "quadIn" "quadOut" "quadInOut" "powerIn" "powerOut" "powerInOut" "sinusInOut"

Parameters:
Name Type Description
properties object

An object containing key-value pairs in the following format: { "[property name]": "[end value]" }

options object

An object containing key-value pairs for the animation's option: { "duraton": "[animation duration (in ms)]", "callback": "[callback function]", "easing": "[easing function to use]" }

Inherited From:
Source:

contains(object) → {boolean}

Checks whether or not the Circle contains another geometric object.

Parameters:
Name Type Description
object Math.Vector | Math.Line | Math.Circle | Math.Rectangle | Math.Polygon

A geometric object to check

Source:
Returns:

True if the Rectangle contains the checked object, false if not

Type
boolean

copy() → {Math.Circle}

Copies the Circle object.

Source:
Returns:

A copy of the Circle object (which can be modified without changing the original object)

Type
Math.Circle

getAnimations() → {Object[]}

Fetches all current animations of the object.

Inherited From:
Source:
Returns:

An array of all the current animations of the object

Type
Object[]

getArea() → {number}

Calculates the area of the Circle.

Source:
Returns:

The area of the Circle

Type
number

getDistance(object) → {number}

Calculates the shortest distance from the Circle object to another geometric object

Parameters:
Name Type Description
object Math.Vector | Math.Line | Math.Circle | Math.Rectangle | Math.Polygon

The object to calculate the distance to

Source:
Returns:

The distance

Type
number

getPerimeter() → {number}

Calculates the perimeter of the circle

Source:
Returns:

The perimeter of the Circle

Type
number

intersects(object) → {boolean}

Checks whether or not the Circle intersects with another geometric object.

Parameters:
Name Type Description
object Math.Line | Math.Circle | Math.Rectangle | Math.Polygon

A geometric object to check. Supported objects are

Source:
Returns:

True if the Circle intersects with the checked object, false if not

Type
boolean

isAnimated() → {boolean}

Checks if the object is currently being animated.

Inherited From:
Source:
Returns:

Whether or not the object is being animated

Type
boolean

move(x, y) → {Math.Circle}

Moves the Circle by adding a value to its x-coordinate and another value to its y-coordinate.

Parameters:
Name Type Description
x number

The value to add to the x-coordinate (can be negative)

y number

The value to add to the y-coordinate (can be negative)

Source:
Returns:

The resulting Circle object (itself)

Type
Math.Circle

moveTo(x, y) → {Math.Circle}

Moves the Circle to a fixed position by setting its x- and y-coordinates.

Parameters:
Name Type Description
x number

The x-coordinate of the position to move the Circle to

y number

The y-coordinate of the position to move the Circle to

Source:
Returns:

The resulting Circle object (itself)

Type
Math.Circle

propertyIsAnimated() → {boolean}

Checks if a specific property is current being animated

Inherited From:
Source:
Returns:

Whether or not the property is being animated

Type
boolean

scale(factor) → {Math.Circle}

Scales the Circle object by multiplying it radius with a factor. Please notice that, opposite to the Polygon and Line objects, the position of the Circle will not be changed by scaling it, since the center of the circle will not be scaled. Also: since ellipses are not supported yet, circles cannot be scaled with various factors horizontally and vertically, like the other geometric objects.

Parameters:
Name Type Description
factor number

A factor with which to scale the Circle

Source:
Returns:

The resulting Circle object (itself)

Type
Math.Circle

set(x, y, radius) → {Math.Circle}

Sets the properties of the circle.

Parameters:
Name Type Description
x number

The x-coordinate for the center of the circle

y number

The y-coordinate for the center of the circle

radius number

The radius for the circle

Source:
Returns:

The resulting Circle object (itself)

Type
Math.Circle

stopAnimations()

Stops all current animations of the object.

Inherited From:
Source:

Generated with wicked.
Clone this wiki locally