trassel
Version:
Graph computing in JavaScript
18 lines (17 loc) • 830 B
TypeScript
/**
* Creates a gravitational force that pulls the x or y axis of nodes towards a given coordinate
* Two sets of attraction components can commonly be used to create a gravitational force towards a center area
* This can also be use to draw nodes away from a given point, if a negative strength is provided.
* @param {number=} isHorizontal - true = x, false = y
* @param {number=} coordinate - the center coordinate of the component
* @param {number=} strength - The strength of the pull
*/
export default class Attraction extends LayoutComponent {
constructor(isHorizontal?: boolean, coordinate?: number, strength?: number);
isHorizontal: boolean;
coordinate: number;
strength: number;
initialize(...args: any[]): void;
execute(alpha: any): void;
}
import LayoutComponent from "./layoutcomponent";