Line API

Lines connect several locations with each other. You can choose between various styles.

Example (Line Properties)

Add a Line

Use EarthInstance.addLine( properties )

var myline = myearth.addLine( {
	locations: [
		{ lat : 40.5, lng : -1 },
		{ lat : 48.8, lng : 8.6 },
	],
	offsetFlow: 1,
	width: 2
} );

Line Properties

locations (array of lat/lng objects)

[]

You must provide at least to two locations (start and end point).

offset (float)

0.01

Distance to the earth surface.

offsetFlow (float)

0

Offset at the end location. When used with offsetEasing: "arc" (default), this property determines the height of the arc.

offsetEasing (easing)

"arc"

An easing function that describes the offsetFlow from start to end.

color (color)

#FF0000

hairline (boolean)

false

width (float)

1

Only available if hairline: false

endWidth (float)

-1 (same value as width)

Width at the end point.
Only available if hairline: false

clip (float)

1

0.0 - 1.0

Displays only a part of the line. A clip value of 0.5 displays only the first half of the line.

dashed (boolean)

true

dashSize (float)

0.5

dashRatio (float)

0.5

0.01 - 0.99

dashOffset (float)

0

A dashed line is rendered as a transparent object and has some limitations.

opacity (float)

1

0.0 - 1.0

transparent (boolean)

false (if opacity is not set and dashed: false)

Needs to be true for using opacity and dashed lines.
Example: Transparent Rendering

visible (boolean)

true

Advanced:

alwaysBehind (boolean)

false

Lines set to alwaysBehind: true are rendered behind Markers, Images and other Lines.
Example: alwaysBehind

earth (EarthInstance)

Reference to the EarthInstance.

object3d (THREE.Object3D)

About THREE.js

 
You can add custom properties that are copied over to the LineInstance.

Line Methods

animate( property, value, animationProperties ) returns AnimationInstance

property
Name of the animatable property (String)
value
Target value
animationProperties
Object of animation properties

Example: Animatable Properties

stopAllAnimations( triggerComplete, jumpToEnd )

triggerComplete
(boolean) default: false | Calls the complete functions
jumpToEnd
(boolean) default: false | Sets the properties immediately to their end values

Stops all animations of this object. To stop a specific animation use AnimationInstance.stop()

remove( )

Removes the line permanently.