Files
zhengte.babylonjs-sdk/index.html
2026-01-05 14:05:10 +08:00

52 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D模型展示SDK - TS版</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
overflow: hidden;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
#app { width: 100vw; height: 100vh; position: relative; }
#renderDom { width: 100%; height: 100%; display: block; }
</style>
</head>
<body>
<div id="app">
<canvas id="renderDom"></canvas>
</div>
<!-- 模块化加载Dev 下通过 Vite构建后 postbuild 会替换为 /assets/index.js -->
<script type="module" src="/src/main.ts"></script>
<script>
const config = {
container: 'renderDom',
modelUrlList: ["/model/model.glb"],
animationUrlList: [],
idleAnimationUrlList: [],
onSuccess: () => console.log('SDK initialized'),
onError: (err) => console.error('SDK init error', err),
};
function startSdk() {
const kernel = window.faceSDK && window.faceSDK.kernel;
if (!kernel) {
console.error('SDK kernel not loaded');
return;
}
kernel.init(config);
}
if (document.readyState === 'complete') {
startSdk();
} else {
window.addEventListener('load', startSdk);
}
</script>
</body>
</html>