three.js 播放动画

加载动画 let nameToClip = {}; let mixer = null; const loader = new GLTFLoader(); loader.load('/threed/models/' + modelName, function (gltf) { let mode

Halo Halo 发布于 2024-01-11

js ws订阅

export function subMoving(onOpenFun, onMsgFun, onCloseFun) { let lockReconnect = false; var url = window._CONFIG['domianURL'].replace("https:/

Halo Halo 发布于 2023-12-11

vue setup 语法糖常见用法

获取this import { getCurrentInstance } from 'vue' const that = getCurrentInstance() 获取路由 // 跳路由 import router from "@/router/index" const routerpath =

Halo Halo 发布于 2023-11-29

three.js 鼠标移动物体

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Three.js_MouseEvent</title> <style> body { margi

Halo Halo 发布于 2023-10-07

three.js更改对象属性

更改背景 let scene = new THREE.Scene() scene.background = new THREE.TextureLoader().load(image); scene.background = new THREE.Color(color) 更改对象材质 // Crea

Halo Halo 发布于 2023-10-07

three.js获取模型所有子对象

new OBJLoader().load('dt.obj', function (object) { function getChildrenObj(object, resultMap) { object.traverse((v) => { if (v.isMesh && v

Halo Halo 发布于 2023-09-28

three.js灯光

DirectinalLight(平行光) 方向光,常常用来表现太阳光照的效果 创建 const light = new THREE.DirectionalLight(0xffffff, 1); light.position.set(0, 10, 0); light.target.position.s

Halo Halo 发布于 2023-09-27

three.js自动放置模型位置

function autoLocalOneModel(object, camera, controls) { const box = new THREE.Box3().setFromObject(object); const boxSize = box.getSize(new THREE.V

Halo Halo 发布于 2023-09-27

three.js相机属性

OrthographicCamera(正交相机) 物体显示的大小和绘制时一样大小,是不会因为距离目测点远而变小的。实际生产环境一般不会选这种模式,因为和我们日常所见不一样 创建 const k = window.innerWidth / window.innerHeight; const s = 6

Halo Halo 发布于 2023-09-27

three.js普通地面视角

<template> <div id="webgl"></div> </template> <script setup lang="ts" name="index"> import * as THREE from 'three'; import { OrbitControls } from 't

Halo Halo 发布于 2023-09-15