当前位置: 首页 > news >正文

vue3 3D炫酷模型banner图

项目场景:

在官网首页展示3D炫酷动画模型,让整个模型都展示出来。


问题描述

主要是3D动画的展示效果,有些3d模型网站可以从51建模网站中获取。


案例代码:

<script setup>
import * as imgs from '../units/img'
import { onMounted, reactive, ref } from 'vue';
import { orderList, orderOtherList, teachersList, modelList } from '../units/img';
import MoveLeftTwo from '../components/MoveLeftTwo.vue';
import WordsListTwo from '../components/WordsListTwo.vue'
import ShowDialog from '../components/ShowDialog.vue'
import { ElScrollbar, ElLoading } from 'element-plus'import { vue3dLoader } from "vue-3d-loader";const lights = ref([{type: 'HemisphereLight',position: { x: 0, y: 1, z: 0 },skyColor: 0xffffff,// groundColor: 0xFF0000, // 此代码为灯光后颜色intensity: 1,
},
{type: 'DirectionalLight',position: { x: 1, y: 1, z: 1 },color: 0xffffff,intensity: .8,
}])
const scale = ref({ x: 1, y: 1, z: 0.2 })
const rotation = ref({x: 0,y: 0,z: 0,})
const onLoad = () => {rotate()
}
const rotate = () => {requestAnimationFrame(rotate());//实现自动旋转效果rotation.value.y += 0.001;
}
</script><template><div class="pageBoxs"><div class="contentModels"><h1 class="contentTitle">国内领先的3D互动展示平台</h1><p class="contentSubTitle">为创作者提供丰富的精品模型及<br/>强大的在线3D编辑展示引擎</p></div><div class="threeModels"><vue3dLoader style="height: 100vh;width:100%;" :showFps="false" :scale="scale" :rotation="rotation" :lights="lights"filePath="girls/scene.gltf" :backgroundAlpha="0" @load="onLoad" @process="process"></vue3dLoader></div></div>
</template>
<style scoped lang="less">
.pageBoxs {// border: 1px solid;height: 100vh;background: url(../assets/img/3d/bg.png) no-repeat;background-position: center;background-size: cover;position: relative;.contentModels {.contentTitle{position: absolute;top: 35%;left: 15%;font-size: 52px;font-weight: 400;}.contentSubTitle {position: absolute;left: 15%;top: 46%;font-size: 28px;line-height: 48px;width: 442px;}}.threeModels {position: absolute;height: 100vh;width: 50%;right: 0;display: flex;justify-content: center;}
}
</style>

收获

        可以从其它的网站中学习新的功能,让前端技能丰富起来。

http://www.lryc.cn/news/355352.html

相关文章:

  • 小程序内使用路由
  • 【数据结构】第七节:堆
  • 前端大师-高级Web开发测验
  • 延迟初始化和密封类
  • Kotlin基础之基本语法
  • 多态(难的起飞)
  • 安装GO环境
  • 记一次由于代码原因导致Mysql连接被打满和唯一索引重复问题
  • redis数据类型之string,list
  • Android android.os.DeadObjectException aidl通信异常分析及解决
  • dp + 计数,1954D - Colored Balls
  • 【设计模式深度剖析】【5】【结构型】【桥接模式】| 以电视和遥控器为例加深理解
  • 一键安装脚本sh
  • WebGL在医学成像方面的应用
  • SpringBoot+layuimini实现角色权限菜单增删改查(layui扩展组件 dtree)
  • 项目范围管理
  • 监管端..
  • 点击登录按钮先检测输入框的规则检测(vue组合式)
  • 网络工程师---第四十二天
  • leetcode 1241每个帖子的评论数(postgresql)
  • 前端最新面试题(ES6模块篇)
  • STM32H750外设之ADC通道选择
  • 【Unity2D 2022:Cinemachine】相机跟随与地图边界
  • ssh远程连接的相关配置
  • 在leafet上画圆、多边形、线、矩形
  • SpringBoot中如何在服务器进行校验?
  • element ui 的el-input输入一个字后失去焦点,需重新点击输入框才能再次输入
  • 【绝地求生game】
  • Mac上Steam安装的游戏已经卸载,但游戏的快捷方式图标仍存在的解决方式
  • PTA 判断两个矩阵相等