OMBlock()

block类, 在编辑器中,此类实例是在 EBlock 类中创建 data: { points: [float[]] // 二维数组,第一个值为轮廓,之后的都为holes }

new OMBlock()

Members

height

体块儿的高度

Methods

addTopImage(idOrData) → {PlaneMarkerNode}

创建一个新的 topImage
Parameters:
Name Type Description
idOrData string | object imageID or topImageData
Returns:
PlaneMarkerNode - 创建的顶面贴图

build(data, params)

build block
Parameters:
Name Type Description
data Array | Object 点数据或整体的data数据
params object 一些补充的创建参数
Properties
Name Type Description
buildTopImage boolean 是否创建顶面贴图, 用于在Editor中从编辑模式回到默认模式时,会重建block,但并不重新创建顶面图

buildBorder(vss) → {Line}

创建体块的轮廓线
Parameters:
Name Type Description
vss Array 点的集合 [[v3, v3, v3, ...], ...]
Returns:
Line

buildTopImages()

创建顶面贴图 topImageData is array

changeType(typeID)

修改体块的类型
Parameters:
Name Type Description
typeID string | int typeID

disposeBorderLine()

消除轮廓线

flashHeight(data) → {OMBlock}

体块儿的高度动画
Parameters:
Name Type Description
data object {duration: 1000}
Properties
Name Type Attributes Default Description
duration int <optional>
800 设置动画时间
scale float <optional>
2.8 设置高度时的缩放比例
Returns:
OMBlock - this

getMaxArea() → {Object}

得到体块儿顶面上的最大内切圆, 用于放置 topImage
Returns:
Object

getStyle()

通过 typeID 得到此block的主题样式

removeTopImage()

移除指定的 topImage

removeTopImages()

移除所有的 topImage

setAlpha(alpha)

设置体块透明度
Parameters:
Name Type Description
alpha float 0 ~ 1

setColor(color, borderColor)

设置体块及边框的颜色
Parameters:
Name Type Description
color stringColor | hexColor 体块颜色
borderColor stringColor | hexColor 边框颜色

setHeight()

设置体块的高度

setType(typeID)

通过typeID设置体块的类型样式
Parameters:
Name Type Description
typeID string typeID

updateStyle()

通过 typeID ,更新 此 block 的样式