This repository was archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
API
Pouya Kary edited this page Jun 22, 2016
·
17 revisions

This function creates a dot and places it at a random coordinate.
newdot( ): Dot
// generates a dot at some random coordinates
var dot = newdot( )This function generates a specified number of dots by iterating over the newdot( ) function.
newdots( howManyDots: number ): Array<Dots>
// create an array of 5 new dots just added to the screen
let dots = newdots( 5 )Creates a dot at the coordinates (x, y)
newdotat( x: number, y: number ): Dot
// you can create a dot like....
var dot = newdotat( 50, 100 )This function gets a dot based on it's number id.
getdot( id: number ): Dot
// gets the dot object for dot with id 5
let dot = getdot( 5 )Gets an array of dots based on the array of ids
getdots( ...ids: Array<number> ): Array<Dot>
var a: Array<Dot> = getdots( 2, 5, 7 )Connects an array of dots in order
connect( ...dotOrId: Array<Dot|number> )
// this connects 1 to 2 and 2 to 3
let dot3 = getdot( 3 )
connect( 1, 2, dot3 )
Disconnects two dots from each other.
disconnect( dot1: number | Dot, dot2: number | Dot ): boolean
// you can use both dot id or dot object to disconnect each dot from each other assuming 1 and 2 are connected to each other.
var dot1 = getdot( 1 )
disconnect( dot1, 2 )