deep-engine-demo/packages/docs/api/mesh/FlowLine.md
2026-04-19 18:46:28 +08:00

6.8 KiB
Raw Blame History

outline
2
3

FlowLine

  • 源文件:packages/sdk/src/mesh/FlowLine.ts
  • 文档位置:packages/docs/api/mesh/FlowLine.md

类:FlowLine

  • 作用FlowLine 类。

构造函数

new FlowLine(options: { points?: THREE.Vector3[]; textureUrl?: string | null; radius?: number; radialSegments?: number; cornerRadius?: number; cornerSplit?: number; scrollSpeed?: number; flowDirection?: number; [key: string]: any; } = {})

  • 作用:创建 FlowLine 实例。

  • 入参:

参数名 类型 必填 说明
options { points?: THREE.Vector3[]; textureUrl?: string | null; radius?: number; radialSegments?: number; cornerRadius?: number; cornerSplit?: number; scrollSpeed?: number; flowDirection?: number; [key: string]: any; } 当前功能对应的配置项。
  • 出参:FlowLine
  • 返回说明:返回当前类实例。

属性

属性名 可见性 类型 作用
points public THREE.Vector3[] 用于保存 points 的集合数据。
textureUrl public string | null 用于保存 textureUrl 对应的数据。
options public { radius: number; radialSegments: number; cornerRadius: number; cornerSplit: number; scrollSpeed: number; flowDirection: number; } 用于保存 options 对应的数据。
pathPointList public PathPointList | null 用于保存 pathPointList 对应的数据。
geometry public PathTubeGeometry | null 用于保存 geometry 对应的数据。
material public THREE.MeshPhongMaterial | null 材质参数。
mesh public THREE.Mesh | null 用于保存 mesh 对应的数据。
texture public THREE.Texture | null 用于保存 texture 对应的数据。
playing public boolean 用于标记 playing 的启用状态。
progress public number 用于保存 progress 对应的数据。
playSpeed public number 用于保存 playSpeed 对应的数据。
textureAnimating public boolean 用于标记 textureAnimating 的启用状态。
textureAnimationSpeed public number 用于保存 textureAnimationSpeed 对应的数据。

方法

init(): void

  • 作用:执行 init 初始化逻辑。

  • 入参:无

  • 出参:void

  • 返回说明:无返回值。

loadTexture(url: string): void

  • 作用:加载 Texture。

  • 入参:

参数名 类型 必填 说明
url string 资源地址。
  • 出参:void
  • 返回说明:无返回值。

addToScene(scene: THREE.Scene): void

  • 作用:添加 To Scene。

  • 入参:

参数名 类型 必填 说明
scene THREE.Scene 目标场景实例。
  • 出参:void
  • 返回说明:无返回值。

removeFromScene(scene: THREE.Scene): void

  • 作用:移除 From Scene。

  • 入参:

参数名 类型 必填 说明
scene THREE.Scene 目标场景实例。
  • 出参:void
  • 返回说明:无返回值。

startAnimation(): void

  • 作用:执行 start Animation 相关逻辑。

  • 入参:无

  • 出参:void

  • 返回说明:无返回值。

stopAnimation(): void

  • 作用:执行 stop Animation 相关逻辑。

  • 入参:无

  • 出参:void

  • 返回说明:无返回值。

startTextureAnimation(): void

  • 作用:开始纹理动画

  • 入参:无

  • 出参:void

  • 返回说明:无返回值。

stopTextureAnimation(): void

  • 作用:停止纹理动画

  • 入参:无

  • 出参:void

  • 返回说明:无返回值。

update(): void

  • 作用:更新 update。

  • 入参:无

  • 出参:void

  • 返回说明:无返回值。

updateTextureAnimation(): void

  • 作用:更新纹理动画

  • 入参:无

  • 出参:void

  • 返回说明:无返回值。

setTextureAnimationSpeed(speed: number): void

  • 作用:设置纹理动画速度

  • 入参:

参数名 类型 必填 说明
speed number 速度系数1.0 为默认速度
  • 出参:void
  • 返回说明:无返回值。

getTextureAnimationSpeed(): number

  • 作用:获取纹理动画速度

  • 入参:无

  • 出参:number

  • 返回说明:纹理动画速度

toggleTextureAnimation(): boolean

  • 作用:切换纹理动画状态

  • 入参:无

  • 出参:boolean

  • 返回说明:切换后的状态

setFlowDirection(direction: number): void

  • 作用:设置 Flow Direction。

  • 入参:

参数名 类型 必填 说明
direction number 参数 direction,类型为 number
  • 出参:void
  • 返回说明:无返回值。

setScrollSpeed(speed: number): void

  • 作用:设置 Scroll Speed。

  • 入参:

参数名 类型 必填 说明
speed number 参数 speed,类型为 number
  • 出参:void
  • 返回说明:无返回值。

setPlaySpeed(speed: number): void

  • 作用:设置 Play Speed。

  • 入参:

参数名 类型 必填 说明
speed number 参数 speed,类型为 number
  • 出参:void
  • 返回说明:无返回值。

updatePoints(points: THREE.Vector3[]): void

  • 作用:更新 Points。

  • 入参:

参数名 类型 必填 说明
points THREE.Vector3[] 参数 points,类型为 THREE.Vector3[]
  • 出参:void
  • 返回说明:无返回值。

updateRadius(radius: number): void

  • 作用:更新 Radius。

  • 入参:

参数名 类型 必填 说明
radius number 半径参数。
  • 出参:void
  • 返回说明:无返回值。

getMesh(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material<THREE.MaterialEventMap> | THREE.Material<THREE.MaterialEventMap>[], THREE.Object3DEventMap> | null

  • 作用:获取 Mesh。

  • 入参:无

  • 出参:THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material<THREE.MaterialEventMap> \| THREE.Material<THREE.MaterialEventMap>[], THREE.Object3DEventMap> \| null

  • 返回说明:返回 THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material<THREE.MaterialEventMap> | THREE.Material<THREE.MaterialEventMap>[], THREE.Object3DEventMap> | null

构造示例

  • 当前 Demo 中没有直接展示 FlowLine 的构造调用。

函数示例

  • 当前 Demo 中没有直接展示 FlowLine 的公开方法调用。