Skip to content
导览

路径动画管理 PathAnimationManager

路径动画管理器是用于控制云渲染路径动画的工具,通过获取该管理器,用户可以方便地进行路径动画的控制和管理。 该工具的主要功能包括:

  1. 添加路径动画
  2. 获取路径动画对象
  3. 获取所有的路径动画对象
  4. 删除路径动画
  5. 设置路径动画的移动路径

我们将提供详细的使用指南和功能说明,帮助用户更好地使用该工具。

PathAnimationManager

用户可以调用云渲染实例 cloud 上的 getPathAnimationManager() 方法来获取 PathAnimationManager 路径管理器。

ts
const pathAnimationManager = await cloud.getPathAnimationManager()
const pathAnimationManager = await cloud.getPathAnimationManager()

用户调用 cloud.getPathAnimationManager() 后,PathAnimationManager 会被自动挂载到当前 cloud 实例上。

ts
await cloud.getPathAnimationManager()
const pathAnimationManager = cloud.pathAnimationManager
await cloud.getPathAnimationManager()
const pathAnimationManager = cloud.pathAnimationManager

添加路径动画 | addPathAnimation

  • 说明:添加路径动画

我们可以调用 PathAnimationManager 上面的 addPathAnimation 方法来添加路径动画。

  • 参数说明
NameTypeDescription
Paramsanyjson 字符串 格式为:{
    Modelactions: [  //设置路径中每段路模型的姿态动作
        "Walk",
        "Walk",
        "Run"
    ],
    animationModel: "avatar_woman.wlkx", //模型文件
    bindCamera: true,  //是否绑定相机(选填)
    contentStyle: {  //样式设置
        color: "0XFF000000", //字体颜色(选填)
        fontFace: "宋体", //字体类型(选填)
        outLineColor: "0XFFFF0000", //轮廓线颜色(选填)
        outLineWidth: 3, //轮廓线宽度(选填)
        rectBorderColor: "0xFFFF0000", //背景框颜色(选填)
        rectBorderShow: false,//是否显示背景框(选填)
        backGroundColor: '0xFF0000FF', //背景颜色(选填)
        size: 10, //文字大小(选填)
        titleTextPortrait: false //文字排列方式(横向或纵向)(选填)
    },
    loop: false,  //是否循环播放(选填)
    pathid: "E24FAB463E5746FE98F100918D4B32E3", //路径对象Guid值
    play: false,//加载完后是否立即播放(选填)
    reverse: false, //是否倒播(选填)
    speed: 4, //播放速度(选填)
    titleText: "路径动画LH" //铭牌标题(选填)
}|

调用示例:

ts
const pathAnimationManager = await cloud.getPathAnimationManager()
const param = {
  Modelactions: [
      "Walk",
      "Walk",
      "Run"
  ],
  animationModel: "avatar_woman.wlkx",
  bindCamera: true,
  contentStyle: {
      color: "0XFF000000",
      fontFace: "宋体",
      outLineColor: "0XFFFF0000",
      outLineWidth: 3,
      rectBorderColor: "0xFFFF0000",
      rectBorderShow: false,
      backGroundColor: '0xFF0000FF',
      size: 10,
      titleTextPortrait: false
  },
  loop: false,
  pathid: "E24FAB463E5746FE98F100918D4B32E3",
  play: false,
  reverse: false,
  speed: 4,
  titleText: "路径动画LH"
}
await pathAnimationManager.addPathAnimation(param);
const pathAnimationManager = await cloud.getPathAnimationManager()
const param = {
  Modelactions: [
      "Walk",
      "Walk",
      "Run"
  ],
  animationModel: "avatar_woman.wlkx",
  bindCamera: true,
  contentStyle: {
      color: "0XFF000000",
      fontFace: "宋体",
      outLineColor: "0XFFFF0000",
      outLineWidth: 3,
      rectBorderColor: "0xFFFF0000",
      rectBorderShow: false,
      backGroundColor: '0xFF0000FF',
      size: 10,
      titleTextPortrait: false
  },
  loop: false,
  pathid: "E24FAB463E5746FE98F100918D4B32E3",
  play: false,
  reverse: false,
  speed: 4,
  titleText: "路径动画LH"
}
await pathAnimationManager.addPathAnimation(param);

获取路径动画对象 | getPathAnimation

  • 说明:获取路径动画对象

我们可以调用 PathAnimationManager 上面的 getPathAnimation 方法来获取路径动画对象。

  • 参数说明
NameTypeDescription
guidstring对象guid值

调用示例:

ts
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.getPathAnimation("E24FAB463E5746FE98F100918D4B32E3");
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.getPathAnimation("E24FAB463E5746FE98F100918D4B32E3");

获取所有的路径动画对象 | getAllPathAnimation

  • 说明:获取所有的路径动画对象

我们可以调用 PathAnimationManager 上面的 getAllPathAnimation 方法来获取所有的路径动画对象。

调用示例:

ts
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.getAllPathAnimation();
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.getAllPathAnimation();

删除路径动画 | removePathAnimation

  • 说明:删除路径动画

我们可以调用 PathAnimationManager 上面的 removePathAnimation 方法来删除路径动画。

  • 参数说明
NameTypeDescription
guidstring对象guid值

调用示例:

ts
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.removePathAnimation("E24FAB463E5746FE98F100918D4B32E3");
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.removePathAnimation("E24FAB463E5746FE98F100918D4B32E3");

设置路径动画的移动路径 | bindPathWithPathAnima

  • 说明:设置路径动画的移动路径

我们可以调用 PathAnimationManager 上面的 bindPathWithPathAnima 方法来设置路径动画的移动路径。

  • 参数说明
NameTypeDescription
pathAnimGuidstring路径动画对象guid值
pathGuidstring路径对象guid值

调用示例:

ts
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.bindPathWithPathAnima("E24FAB463E5746FE98F100918D4B32E3", "E24FAB463E5746FE98F100918D4B32E2");
const pathAnimationManager = await cloud.getPathAnimationManager();
await pathAnimationManager.bindPathWithPathAnima("E24FAB463E5746FE98F100918D4B32E3", "E24FAB463E5746FE98F100918D4B32E2");