案例展示
创建精灵图形
<template>
<div id="TO"></div>
</template>
<script setup>
import { onMounted } from "vue";
onMounted(() => {
let TO = new ThingOrigin("fileModel", document.getElementById("TO"), {
helper: {
axes: {
active: true,
},
grid: {
active: true,
},
}
})
//创建精灵图形
let SpriteShape = TO.model.initSpriteShape(
{
modelName: "spriteShape-" + new Date().getTime(),
base: {
positions: [],
spriteShape: {
shape: "sphere", //形状类型 例:'sphere'||'triangle'
color: "#f00",
radius: 5,
},
},
position: {
x: 0,
y: 0,
z: 0,
},
scale: {
x: 1,
y: 1,
z: 1,
},
rotation: {
x: 0,
y: 0,
z: 0,
},
}
);
TO.scene.add(SpriteShape);
})
</script>
<style scoped>
#TO {
width: 100%;
height: 400px;
position: relative;
}
</style>
API 介绍
model.initSpriteShape
方法签名 | 返回值 | 描述 |
---|---|---|
initSpriteShape(modelInfo?: any) | Object3D | 创建精灵图形 |
参数说明:
参数名 | 类型 | 是否必选 | 描述 |
---|---|---|---|
modelInfo | any | 否 | 模型参数 |