1.2.8 • Published 2 years ago

verge-blocks v1.2.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

verge-blocks

Verge3D + vue3 + vite 模块化开发

安装

npm install verge-blocks

用法

App.vue:

<template>
  <div :id="containerId" class="v3d-container">
  </div>
</template>

<script setup>
import { onMounted, onBeforeUnmount } from 'vue'
import { CONTAINER_ID, createApp, onAppRun } from 'verge-blocks'

const containerId = CONTAINER_ID;
const url = '/gltf/Cube.gltf';

let app = null;
onMounted(()=>{
  app = createApp(url, {
    useBkgTransp: true,
    preloader:{
      background:'#ffffff'
    }
  });
});
onBeforeUnmount(()=>{
  if (app) {
    app.dispose();
    app = null;
  }
});

onAppRun(()=>{
  // do something
});

</script>

<style>
@import "css/app.css";
</style>

blocks

_pGlob

全局变量。

CONTAINER_ID

用于挂载canvas元素的ID。

createApp(sceneURL, options)

用于创建verge3d应用实例。

参数:

  • sceneURL - 必须,要加载的.gltf地址
  • options - 可选,app初始化参数

onSceneLoaded(callback)

三维场景加载完成时的钩子函数。

onAppRun(callback)

app运行时的钩子函数,在场景加载完成之后。

onAppDispose(callback)

app被销毁时的钩子函数。

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago