Creates a LinkType object, which defines parameters for Links. It's easier to do this through
Psynth.Graph#addLinkType.
A LinkType must be added to a
Graph before
Links can be created of that type.
Parameters:
Name |
Type |
Description |
params |
|
Properties
Name |
Type |
Argument |
Default |
Description |
name |
string
|
<optional>
|
'Links'
|
The name of this LinkType. Should be unique to this Graph. |
icon |
string
|
<optional>
|
'img/link_icon.png'
|
A URL for an image to display as an icon for this LinkType. Should be 24x21 pixels, with a transparent background. |
tile |
string
|
<optional>
|
'img/link_tile.png'
|
A URL for an image to display on the tiling sprite for this LinkType. Should be 100x21 pixels, with a transparent background. |
color |
string
|
<optional>
|
'dynamic'
|
The color for this LinkType. Should be a string such as "#FFFFFF" 'dynamic' will make the color responsive to user palette changes. |
max |
number
|
<optional>
|
10
|
The maximum value any Link of this LinkType can have. Must be >= 1. |
sync |
boolean
|
<optional>
|
true
|
Whether the icons should reflect the color of the line. |
|
- Source:
Examples
Using the constructor directly
var lt = new Psynth.LinkType({name: 'Positive',
max: 10,
icon: 'img/pos_icon.png',
tile: 'img/pos_tile.png',
color: '#1aa2d4'});
g.addLinkType(lt);
A better way
var lt = g.addLinkType({name: 'Positive',
max: 10,
icon: 'img/pos_icon.png',
tile: 'img/pos_tile.png',
color: '#1aa2d4'});