Skip to content

Circle

Overview

A circular node that inherits Path, and allows for optimized drawing and improved parameter handling.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class Circle

import { Circle } from 'scenerystack/scenery';

Constructor

new Circle( options? : CircleOptions )

Instance Methods

intersectsBoundsSelf( bounds : Bounds2 ) : boolean

Returns whether this Circle's selfBounds is intersected by the specified bounds.

@param bounds - Bounds to test, assumed to be in the local coordinate frame.

canvasPaintSelf( wrapper : CanvasContextWrapper, matrix : Matrix3 )

(protected)

Draws the current Node's self representation, assuming the wrapper's Canvas context is already in the local coordinate frame of this node.

@param wrapper @param matrix - The transformation matrix already applied to the context.

setRadius( radius : number ) : this

Sets the radius of the circle.

getRadius() : number

Returns the radius of the circle.

computeShapeBounds() : Bounds2

Computes the bounds of the Circle, including any applied stroke. Overridden for efficiency.

containsPointSelf( point : Vector2 ) : boolean

Computes whether the provided point is "inside" (contained) in this Circle's self content, or "outside".

Exists to optimize hit detection, as it's quick to compute for circles.

@param point - Considered to be in the local coordinate frame

setShape( shape : Shape | null ) : this

It is impossible to set another shape on this Path subtype, as its effective shape is determined by other parameters.

@param shape - Throws an error if it is not null.

getShape() : Shape

Returns an immutable copy of this Path subtype's representation.

NOTE: This is created lazily, so don't call it if you don't have to!

hasShape() : boolean

Returns whether this Path has an associated Shape (instead of no shape, represented by null)

setShapeProperty( newTarget : TReadOnlyProperty<Shape | string | null> | null ) : this

mutate( options? : CircleOptions ) : this

Type CircleOptions

import type { CircleOptions } from 'scenerystack/scenery';

Source Code

See the source for Circle.ts in the scenery repository.