Line

Line

new Line(parameters)

Description:
  • 线,支持实线、虚线、流动线,可支持平躺或站立,支持设置线的各类属性,如宽度、是否描边等
Source:
  • objects/line/Line.js, line52
Parameters:
Name Type Description
parameters Object 配置信息
Properties
Name Type Description
style string 线型, 默认实线LineTypeOptions.SOLID, 可选 LineTypeOptions
splineType number 曲线类型, 默认线性LineSplineTypeOptions.LINEAR, 可选 LineSplineTypeOptions, 所有类型都可以自定义设置贴图
direction number 线的拓宽方向,默认LineDirectionOptions.CENTER, 可选LineDirectionOptions
width number 宽度,单位米,默认4
tilling number 纹理在U方向上的平铺密度,renderType为1时值越小密度越大,renderType为0时tilling表示贴图重复量, 默认5
speed number 线贴图的流动速度, 默认1
openStroke boolean 是否有描边, 默认false
strokeColor object | null 描边颜色, 默认null,尚未启用该参数
strokeWidth number 描边宽度,默认1
rotateAngle number 旋转角度, 范围0~1,默认-1,-1代表随线的方向旋转
renderType number 渲染类型,默认0,0为高性能ProcedureMesh渲染,1为常规SplineMesh渲染,2为instanceMesh渲染
section_Length number 渲染时每段长度,默认100,数值越小,精度越高,但性能越差
lineUVOption Object 完全自定义UV配置信息
Properties
Name Type Description
enable boolean 启用完全自定义动画,默认false
speedX number U 方向动画速度,默认1
speedY number V 方向动画速度,默认0
uvRotation number UV旋转角度,默认0,范围0~1表示0~360度
u number 纹理U,默认0,启用lineUVOption后覆盖tilling参数
v number 纹理V,默认0,启用lineUVOption后覆盖tilling参数
collision boolean 是否开启碰撞, 默认false 不开启
isDilution boolean 是否开启抽稀, 默认false 不开启
interval boolean 抽稀间隔, 默认0.00001,经纬度

Extends

Members

(readonly) animateNeedsUpdate

Source:
  • objects/Shape/Shape.js, line814
Inherited From:
Properties:
Name Type Description
animateNeedsUpdate Boolean 动画是否变化

depthTest

Source:
  • objects/Shape/Shape.js, line398
Inherited From:
Default Value:
  • true
Properties:
Name Type Description
depthTest boolean 是否开启深度测试

map

Description:
  • 获取贴图
Source:
  • objects/Shape/Shape.js, line134
Overrides:
获取贴图

(readonly) materialNeedsUpdate

Source:
  • objects/Shape/Shape.js, line802
Overrides:
Properties:
Name Type Description
materialNeedsUpdate Boolean 记录材质是否变化

(readonly) matrixNeedsUpdate

Source:
  • objects/Shape/Shape.js, line796
Inherited From:
Properties:
Name Type Description
matrixNeedsUpdate Boolean 记录空间是否变化

transparent

Source:
  • objects/Shape/Shape.js, line393
Inherited From:
Default Value:
  • opacity < 1.0
Properties:
Name Type Description
transparent boolean 是否透明

type

Source:
  • objects/line/Line.js, line87
Properties:
Name Type Description
type string 几何体类型

visible

Description:
  • 获取可见性状态
Source:
  • objects/Shape/Shape.js, line113
Overrides:
获取可见性状态

(readonly) visibleNeedsUpdate

Source:
  • objects/Shape/Shape.js, line808
Inherited From:
Properties:
Name Type Description
visibleNeedsUpdate Boolean 记录显隐是否变化

Methods

animate(options) → {TWEEN.Tween}

Description:
  • 动画函数,to中的animateOffset表示位置偏移单位cm
Source:
  • objects/Shape/Shape.js, line828
Inherited From:
Parameters:
Name Type Description
options object {from, to, duration, easing, loop}
Properties
Name Type Description
from object 起始值{position:null,rotation:null,scale:null} 可不设置,不设置就是当前状态
to object 结束值{position:{x,y,z},rotation:{roll,pitch,yaw},scale:{x,y,z},animateOffset:{x,y,z}}
duration number 动画持续时间,默认3000豪秒,单位豪秒
easing string 缓动函数 默认Linear,可选 Quadratic,Cubic,Sinusoidal,Exponential
loop boolean 是否循环,默认false
stayEnd boolean 动画结束后是否停留在最后一帧的位置,默认true
Returns:
返回Tween对象,可以调用stop()方法停止动画,onUpdate的时候会返回一个0-1的渐变值
Type
TWEEN.Tween

setData(geoJsonData)

Description:
  • 数据赋值与预处理
Source:
  • objects/line/Line.js, line294
Overrides:
Parameters:
Name Type Description
geoJsonData object geojson格式的几何信息

stopAnimate(delayTime)

Description:
  • 停止动画
Source:
  • objects/Shape/Shape.js, line891
Inherited From:
Parameters:
Name Type Default Description
delayTime 1000 延迟时间,默认为1000毫秒

updataLineColor(colordata)

Description:
  • 创建Line后,进行线段颜色更新
Source:
  • objects/line/Line.js, line321
Parameters:
Name Type Description
colordata array {r: 0, g: 0, b: 0}组成的json数组,与setData的线段一一对应