Class: ConstellationStar

ConstellationStar(ctx, x, y, radius, selected, swell_ratio, color, selected_color, ratio)

This class is intended for interactable stars, it takes the x and y for the foreground star along with radius and color. It will draw a star there, and it reacts to click captures.

Constructor

new ConstellationStar(ctx, x, y, radius, selected, swell_ratio, color, selected_color, ratio)

Takes the x y for the foreground star, along with the radius for the star. The selected state enables or disables the selected swelling animation, and the swell ratio tells how much to swell by.
Parameters:
Name Type Description
ctx CanvasRenderingContext2D canvas rendering context
x Number coordinate
y Number coordinate
radius Number star radius
selected Boolean if is selected
swell_ratio Number animated swelling radius
color String default color
selected_color String selected color
ratio Number aspect ratio
Source:

Classes

ConstellationStar

Members

isSelected

Properties:
Name Type Description
Getter function for is selected
Source:

Methods

click(x, y)

Click event handler, if the click fell within the region of the circle change its selected mode
Parameters:
Name Type Description
x Number clicked coordinate
y Number clicked coordinate
Source:

connect(user_x, user_y, star)

Draw a line between this star and the input star
Parameters:
Name Type Description
user_x Number user view offset x
user_y Number user view offset y
star ConstellationStar stars to connect
Source:

draw(user_x, user_y)

Draws the star based on current values and user_x and user_y
Parameters:
Name Type Description
user_x Number user view offset
user_y Number user view offset
Source:

update(user_x, user_y)

Call with animation loop, updates the swell amount if it is selected else set the swell to 0
Parameters:
Name Type Description
user_x Number user view offset
user_y Number user view offset
Source: