TextPoint

TextPoint

new TextPoint(parameters)

Description:
  • 文字,通过setData可以批量生成文字,可修改文字大小、描边、粗细等等
Source:
  • objects/point/TextPoint.js, line48
Example
const textPoint = new TextPoint({color:{r:0.3,g:0.87,b:0.46},fontSize:12});
textPoint.setData(json);
engine.addToScene(textPoint);
Parameters:
Name Type Description
parameters Object 配置信息
Properties
Name Type Description
pivot Vector2 轴枢点 {x:0.5,y:0.5} x表示左到右:0->1,y表示上到下:0->1
color Color 文字颜色
backgroundColor Color 文字背景颜色,默认值{r:0,g:0,b:0,a:0},会对背景图片产生影响
backgroundImage string 文字背景图片链接地址
margin array 边缘空白,规则同css,默认值[0]
autoWrap number 竖排文字,默认值false(横排),一旦设置不可修改
fontSize number 字号,默认值24
fontWeight boolean 粗细 Thin,Light,Regular,Bold
borderWidth number 文字描边宽度,默认值0
borderColor Color 文字描边颜色
shadowColor Color 文字阴影颜色
shadowOffset Vector2 文字阴影偏移 {x:0,y:0}
renderType number 渲染类型,0基于屏幕空间,1基于场景空间,初始化时一经设置不可更改,默认0
fadeIn boolean 是否开启显隐渐变,默认true
isGlobalPOI boolean 文字是否为球面POI,默认false,非球面工程不需要考虑该设置
openCollision boolean 是否开启屏幕空间碰撞检测,默认false
faceType number text的面向方向,基于场景空间渲染时有效,0不面向摄像机,1完全面向摄像机,2y轴面向摄像机,3z轴面向摄像机, 默认1
switchScale boolean text是否根据距离动态缩放,基于场景空间渲染时有效,默认false
minDistance number text触发动态缩放的距离摄像机最小距离,小于该距离则不触发,基于场景空间渲染时有效,默认0
maxDistance number text触发动态缩放的距离摄像机最大距离,大于该距离则不触发,基于场景空间渲染时有效,默认0
minScale number text触发动态缩放后,摄像机与text距离等于minDistance时的缩放比例,基于场景空间渲染时有效,默认1
maxScale number text触发动态缩放后,摄像机与text距离等于maxDistance时的缩放比例,基于场景空间渲染时有效,默认1
renderNum number 每帧渲染的shape数量,默认10,代表每一帧会渲染10个点位,如果点位太多,会导致渲染性能问题,如果超过20个,则自动启用分帧渲染

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 是否开启深度测试

fadeIn

Source:
  • objects/point/TextPoint.js, line119
Properties:
Name Type Description
fadeIn boolean 显隐渐变,默认值true

map

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

(readonly) materialNeedsUpdate

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

(readonly) matrixNeedsUpdate

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

openCollision

Source:
  • objects/point/TextPoint.js, line124
Properties:
Name Type Description
openCollision boolean 是否开启屏幕空间碰撞,默认值false

renderType

Source:
  • objects/point/TextPoint.js, line114
Properties:
Name Type Description
renderType number 渲染类型,默认值0

transparent

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

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/point/TextPoint.js, line324
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毫秒