Skip to content

案例展示

模型呼吸效果

<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.initBreath(model.scene);
        
    });

});


</script>

<style scoped>
#TO {
    width: 100%;
    height: 400px;
    position: relative;
}
</style>

API 介绍

effect.initBreath

方法签名返回值描述
initBreath(model: any)void给模型添加呼吸效果

参数说明:

参数名类型描述
modelany模型