案例展示
场景剖切效果
<template>
<div id="TO"></div>
</template>
<script setup>
import { onMounted } from 'vue';
onMounted(() => {
let TO = new ThingOrigin("fileModel", document.getElementById("TO"))
TO.model.initFileModel(
{
modelName: "fileModel-" + new Date().getTime(),
base: {
modelUrl: `${import.meta.env.BASE_URL}models/car.gltf`,
},
modelType: "gltf",
position: {
x: 0,
y: 0,
z: 0,
},
scale: {
x: 10,
y: 10,
z: 10,
},
rotation: {
x: 0,
y: 0,
z: 0,
}
}
).then((model) => {
TO.scene.add(model.scene);
TO.effect.initSceneClip("x", 0.1);
});
});
</script>
<style scoped>
#TO {
width: 100%;
height: 400px;
position: relative;
}
</style>
API 介绍
effect.initSceneClip
方法签名 | 返回值 | 描述 |
---|---|---|
initSceneClip(axis: string, constant: number) | void | 创建场景的剖切 |
参数说明:
参数名 | 类型 | 是否必选 | 描述 |
---|---|---|---|
axis | string | 是 | 剖切轴 |
constant | number | 是 | 初始剖切位置 |