跳至主要內容

Door

大约 1 分钟

Door

门,继承自Thing对象,拥有一切Thing属性及方法。

构造器

new VT.Door({
    // 单开 1, 双开 2
    face: 1, 
    // 双开切换
    dblClickToggle: true,
    // 打开配置
    open: {
        opened: false,
        type: "outwards",
        duration: 500,
        easingType: "Cubic",
        easingMode: "Out",
        axesReverse: false,
        directionReverse: false,
    },
    // 几何构造
    geometry: {
        // 宽度
        width: 0.8,
        // 高度
        height: 2.2,
        // 厚度
        depth: 0.045,
    },
    // 贴图配置
    material: {
        // 颜色
        color: "#ffffff",
        // 面
        side: 2,
        // 透明
        transparent: false,
    },
});

属性成员

type

  • 类型:{String} 物体类型Door, 不可改

isDoor

  • 类型:{Boolean} 是否为isDoor,不可更改,默认为true

方法

open

开门

  • open(type)
  • 类型:{Function}
  • 参数:
    • type {String} outwords 外开,side 侧开,up 向上开
  • 返回:无

close

关门

  • close()
  • 类型:{Function}
  • 参数:无
  • 返回:无

toggle

切换门开关状态

  • toggle()
  • 类型:{Function}
  • 参数:无
  • 返回:无

updateOpen

更新打开参数

  • updateOpen(option)
  • 类型:{Function}
  • 参数:
    • option {Object} 打开配置,见构造器 open 配置项
  • 返回:无

sideOpen

开门

  • sideOpen(face)
  • 类型:{Function}
  • 参数:
    • face {Number} 打开的方向,1 为左侧,2 为右侧
  • 返回:无

sideClose

关门

  • sideClose(face)
  • 类型:{Function}
  • 参数:
    • face {Number} 关闭的方向,1 为左侧,2 为右侧
  • 返回:无

upOpen

上开门

  • upOpen(face)
  • 类型:{Function}
  • 参数:
    • face {Number} 关闭的方向,1 为左侧,2 为右侧
  • 返回:无

upClose

上关门

  • upClose(face)
  • 类型:{Function}
  • 参数:
    • face {Number} 关闭的方向,1 为左侧,2 为右侧
  • 返回:无

outwardsOpen

外开门

  • outwardsOpen(face)
  • 类型:{Function}
  • 参数:
    • face {Number} 关闭的方向,1 为左侧,2 为右侧
  • 返回:无

outwardsClose

外关门

  • outwardsClose(face)
  • 类型:{Function}
  • 参数:
    • face {Number} 关闭的方向,1 为左侧,2 为右侧
  • 返回:无

setFace

设置门面数

  • setFace(face)
  • 类型:{Function}
  • 参数:
    • face {Number}
  • 返回:无
上次编辑于:
贡献者: dashun